mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-06-30 17:59:43 +00:00
Update to 1.4.7 R1 :: remove calls to ScheduleAsyncDelayedTask, as it is deprecated :: cleanup :: WARNING: This commit may or may not be stable
This commit is contained in:
parent
3d4d616414
commit
cd126264e0
|
@ -63,6 +63,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.yaml.snakeyaml.error.YAMLException;
|
import org.yaml.snakeyaml.error.YAMLException;
|
||||||
|
|
||||||
|
|
||||||
|
@ -608,9 +609,14 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int scheduleAsyncDelayedTask(final Runnable run)
|
public BukkitTask scheduleAsyncDelayedTask(final Runnable run)
|
||||||
{
|
{
|
||||||
return this.getScheduler().scheduleAsyncDelayedTask(this, run);
|
return this.getScheduler().runTaskAsynchronously(this, run);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public BukkitTask runTaskLaterAsynchronously(final Runnable run, final long delay)
|
||||||
|
{
|
||||||
|
return this.getScheduler().runTaskLaterAsynchronously(this, run, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
|
||||||
public interface IEssentials extends Plugin
|
public interface IEssentials extends Plugin
|
||||||
|
@ -44,7 +45,9 @@ public interface IEssentials extends Plugin
|
||||||
|
|
||||||
Methods getPaymentMethod();
|
Methods getPaymentMethod();
|
||||||
|
|
||||||
int scheduleAsyncDelayedTask(Runnable run);
|
BukkitTask scheduleAsyncDelayedTask(Runnable run);
|
||||||
|
|
||||||
|
BukkitTask runTaskLaterAsynchronously(Runnable run, long delay);
|
||||||
|
|
||||||
int scheduleSyncDelayedTask(Runnable run);
|
int scheduleSyncDelayedTask(Runnable run);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
|
|
||||||
public class Commandheal extends EssentialsCommand
|
public class Commandheal extends EssentialsCommand
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class MetricsListener implements Listener
|
||||||
player.sendMessage("To opt out, run /essentials opt-out");
|
player.sendMessage("To opt out, run /essentials opt-out");
|
||||||
ess.getLogger().log(Level.INFO, "[Metrics] Admin join - Starting 5 minute opt-out period.");
|
ess.getLogger().log(Level.INFO, "[Metrics] Admin join - Starting 5 minute opt-out period.");
|
||||||
ess.getSettings().setMetricsEnabled(true);
|
ess.getSettings().setMetricsEnabled(true);
|
||||||
ess.getScheduler().scheduleAsyncDelayedTask(ess, starter, 5 * 1200);
|
ess.getScheduler().runTaskLaterAsynchronously(ess, starter, 5 * 1200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.earth2me.essentials.protect.data;
|
package com.earth2me.essentials.protect.data;
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
@ -123,11 +123,13 @@ public class ProtectedBlockMemory implements IProtectedBlock
|
||||||
importProtections(storage.exportProtections());
|
importProtections(storage.exportProtections());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clearProtections()
|
public void clearProtections()
|
||||||
{
|
{
|
||||||
blocks.clear();
|
blocks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void importProtections(final List<OwnedBlock> blocks)
|
public final void importProtections(final List<OwnedBlock> blocks)
|
||||||
{
|
{
|
||||||
for (OwnedBlock ownedBlock : blocks)
|
for (OwnedBlock ownedBlock : blocks)
|
||||||
|
@ -141,6 +143,7 @@ public class ProtectedBlockMemory implements IProtectedBlock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<OwnedBlock> exportProtections()
|
public List<OwnedBlock> exportProtections()
|
||||||
{
|
{
|
||||||
final List<OwnedBlock> blockList = new ArrayList<OwnedBlock>(blocks.size());
|
final List<OwnedBlock> blockList = new ArrayList<OwnedBlock>(blocks.size());
|
||||||
|
@ -160,12 +163,14 @@ public class ProtectedBlockMemory implements IProtectedBlock
|
||||||
return blockList;
|
return blockList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void protectBlock(final Block block, final String playerName)
|
public void protectBlock(final Block block, final String playerName)
|
||||||
{
|
{
|
||||||
final ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld()));
|
final ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld()));
|
||||||
protectBlock(pl, playerName);
|
protectBlock(pl, playerName);
|
||||||
plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable()
|
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable()
|
||||||
{
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
storage.protectBlock(block, playerName);
|
storage.protectBlock(block, playerName);
|
||||||
|
@ -173,7 +178,7 @@ public class ProtectedBlockMemory implements IProtectedBlock
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void protectBlock(ProtectedLocation pl, String playerName)
|
private void protectBlock(ProtectedLocation pl, String playerName)
|
||||||
{
|
{
|
||||||
int playerId = getPlayerId(playerName);
|
int playerId = getPlayerId(playerName);
|
||||||
ProtectedBy pb = blocks.get(pl);
|
ProtectedBy pb = blocks.get(pl);
|
||||||
|
@ -185,6 +190,7 @@ public class ProtectedBlockMemory implements IProtectedBlock
|
||||||
pb.add(playerId);
|
pb.add(playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isProtected(Block block, String playerName)
|
public boolean isProtected(Block block, String playerName)
|
||||||
{
|
{
|
||||||
int playerId = getPlayerId(playerName);
|
int playerId = getPlayerId(playerName);
|
||||||
|
@ -193,6 +199,7 @@ public class ProtectedBlockMemory implements IProtectedBlock
|
||||||
return !pb.contains(playerId);
|
return !pb.contains(playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<String> getOwners(Block block)
|
public List<String> getOwners(Block block)
|
||||||
{
|
{
|
||||||
ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld()));
|
ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld()));
|
||||||
|
@ -200,12 +207,14 @@ public class ProtectedBlockMemory implements IProtectedBlock
|
||||||
return pb.getPlayers(playerNames);
|
return pb.getPlayers(playerNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int unprotectBlock(final Block block)
|
public int unprotectBlock(final Block block)
|
||||||
{
|
{
|
||||||
ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld()));
|
ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld()));
|
||||||
ProtectedBy pb = blocks.remove(pl);
|
ProtectedBy pb = blocks.remove(pl);
|
||||||
plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable()
|
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable()
|
||||||
{
|
{
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
storage.unprotectBlock(block);
|
storage.unprotectBlock(block);
|
||||||
|
@ -241,6 +250,7 @@ public class ProtectedBlockMemory implements IProtectedBlock
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onPluginDeactivation()
|
public void onPluginDeactivation()
|
||||||
{
|
{
|
||||||
storage.onPluginDeactivation();
|
storage.onPluginDeactivation();
|
||||||
|
|
BIN
lib/bukkit.jar
BIN
lib/bukkit.jar
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue