Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TorchLight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bukkit Plugin Requests
TorchLight
Commits
3adc24ea
Commit
3adc24ea
authored
10 years ago
by
Zandor Smith
Browse files
Options
Downloads
Patches
Plain Diff
+ Added reset of glowstone blocks on disable.
parent
f81cd1c1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/com/zandor300/torchlight/TorchLight.java
+11
-2
11 additions, 2 deletions
src/main/java/com/zandor300/torchlight/TorchLight.java
with
11 additions
and
2 deletions
src/main/java/com/zandor300/torchlight/TorchLight.java
+
11
−
2
View file @
3adc24ea
...
...
@@ -23,8 +23,10 @@ import org.bukkit.block.BlockState;
import
org.bukkit.entity.Player
;
import
org.bukkit.plugin.PluginManager
;
import
org.bukkit.plugin.java.JavaPlugin
;
import
org.bukkit.scheduler.BukkitTask
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author Zandor Smith
...
...
@@ -36,6 +38,7 @@ public class TorchLight extends JavaPlugin {
private
static
Chat
chat
=
new
Chat
(
"TorchLight"
);
private
static
TorchLight
plugin
;
private
static
BukkitTask
task
;
@Override
public
void
onEnable
()
{
...
...
@@ -44,7 +47,7 @@ public class TorchLight extends JavaPlugin {
plugin
=
this
;
chat
.
sendConsoleMessage
(
"Starting timers..."
);
Bukkit
.
getScheduler
().
runTaskTimer
(
this
,
new
Runnable
()
{
task
=
Bukkit
.
getScheduler
().
runTaskTimer
(
this
,
new
Runnable
()
{
@Override
public
void
run
()
{
for
(
Player
player
:
Bukkit
.
getOnlinePlayers
())
{
...
...
@@ -74,7 +77,13 @@ public class TorchLight extends JavaPlugin {
@Override
public
void
onDisable
()
{
chat
.
sendConsoleMessage
(
"Resetting remaining glowstone blocks..."
);
task
.
cancel
();
for
(
Map
.
Entry
<
String
,
BlockState
>
entry
:
playerState
.
entrySet
())
{
entry
.
getValue
().
getLocation
().
getBlock
().
setType
(
entry
.
getValue
().
getType
());
entry
.
getValue
().
getLocation
().
getBlock
().
setData
(
entry
.
getValue
().
getData
().
getData
());
}
chat
.
sendConsoleMessage
(
"All remaining glowstone blocks have been reset."
);
}
public
static
Chat
getChat
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment