Fix cast exceptions

This commit is contained in:
Daniel Saukel 2016-01-16 20:55:46 +01:00
parent 2fc7e841e1
commit 73bb925df2
4 changed files with 29 additions and 25 deletions

View File

@ -44,6 +44,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
public class DungeonsXL extends JavaPlugin {
@ -63,9 +64,9 @@ public class DungeonsXL extends JavaPlugin {
private Triggers triggers;
private Dungeons dungeons;
private WorldUnloadTask worldUnloadTask;
private LazyUpdateTask lazyUpdateTask;
private UpdateTask updateTask;
private BukkitTask worldUnloadTask;
private BukkitTask lazyUpdateTask;
private BukkitTask updateTask;
private CopyOnWriteArrayList<Player> inBreakMode = new CopyOnWriteArrayList<Player>();
private CopyOnWriteArrayList<Player> chatSpyers = new CopyOnWriteArrayList<Player>();
@ -434,7 +435,7 @@ public class DungeonsXL extends JavaPlugin {
/**
* @return the worldUnloadTask
*/
public WorldUnloadTask getWorldUnloadTask() {
public BukkitTask getWorldUnloadTask() {
return worldUnloadTask;
}
@ -442,13 +443,13 @@ public class DungeonsXL extends JavaPlugin {
* start a new WorldUnloadTask
*/
public void startWorldUnloadTask(long period) {
worldUnloadTask = (WorldUnloadTask) new WorldUnloadTask().runTaskTimerAsynchronously(this, 0L, period);
worldUnloadTask = new WorldUnloadTask().runTaskTimerAsynchronously(this, 0L, period);
}
/**
* @return the lazyUpdateTask
*/
public LazyUpdateTask getLazyUpdateTask() {
public BukkitTask getLazyUpdateTask() {
return lazyUpdateTask;
}
@ -456,13 +457,13 @@ public class DungeonsXL extends JavaPlugin {
* start a new LazyUpdateTask
*/
public void startLazyUpdateTask(long period) {
lazyUpdateTask = (LazyUpdateTask) new LazyUpdateTask().runTaskTimerAsynchronously(this, 0L, period);
lazyUpdateTask = new LazyUpdateTask().runTaskTimerAsynchronously(this, 0L, period);
}
/**
* @return the updateTask
*/
public UpdateTask getUpdateTask() {
public BukkitTask getUpdateTask() {
return updateTask;
}
@ -470,7 +471,7 @@ public class DungeonsXL extends JavaPlugin {
* start a new LazyUpdateTask
*/
public void startUpdateTask(long period) {
updateTask = (UpdateTask) new UpdateTask().runTaskTimerAsynchronously(this, 0L, period);
updateTask = new UpdateTask().runTaskTimerAsynchronously(this, 0L, period);
}
/**

View File

@ -6,6 +6,7 @@ import io.github.dre2n.dungeonsxl.util.NumberUtil;
import org.bukkit.Material;
import org.bukkit.block.Sign;
import org.bukkit.scheduler.BukkitTask;
public class MobSign extends DSign {
@ -18,7 +19,7 @@ public class MobSign extends DSign {
private int amount = 1;
private boolean initialized;
private boolean active;
private MobSpawnTask task;
private BukkitTask task;
public MobSign(Sign sign, GameWorld gameWorld) {
super(sign, gameWorld);
@ -117,7 +118,7 @@ public class MobSign extends DSign {
/**
* @return the task
*/
public MobSpawnTask getTask() {
public BukkitTask getTask() {
return task;
}
@ -125,7 +126,7 @@ public class MobSign extends DSign {
* @param task
* the task to set
*/
public void setTask(MobSpawnTask task) {
public void setTask(BukkitTask task) {
this.task = task;
}
@ -174,7 +175,7 @@ public class MobSign extends DSign {
return;
}
task = (MobSpawnTask) new MobSpawnTask(this).runTaskTimer(plugin, 0L, 20L);
task = new MobSpawnTask(this).runTaskTimer(plugin, 0L, 20L);
active = true;
}

View File

@ -12,6 +12,7 @@ import org.bukkit.block.Sign;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask;
public class MythicMobsSign extends DSign {
@ -24,7 +25,7 @@ public class MythicMobsSign extends DSign {
private int amount = 1;
private boolean initialized;
private boolean active;
private MythicMobSpawnTask task;
private BukkitTask task;
private Location spawnLocation;
private LivingEntity mythicMob;
private ArrayList<Entity> mythicMobs = new ArrayList<Entity>();
@ -171,7 +172,7 @@ public class MythicMobsSign extends DSign {
/**
* @return the task
*/
public MythicMobSpawnTask getTask() {
public BukkitTask getTask() {
return task;
}
@ -179,7 +180,7 @@ public class MythicMobsSign extends DSign {
* @param task
* the task to set
*/
public void setTask(MythicMobSpawnTask task) {
public void setTask(BukkitTask task) {
this.task = task;
}
@ -228,7 +229,7 @@ public class MythicMobsSign extends DSign {
return;
}
task = (MythicMobSpawnTask) new MythicMobSpawnTask(this).runTaskTimer(plugin, 0L, 20L);
task = new MythicMobSpawnTask(this).runTaskTimer(plugin, 0L, 20L);
active = true;
}

View File

@ -7,6 +7,7 @@ import io.github.dre2n.dungeonsxl.util.NumberUtil;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.scheduler.BukkitTask;
public class RedstoneSign extends DSign {
@ -15,8 +16,8 @@ public class RedstoneSign extends DSign {
// Variables
private boolean initialized;
private boolean active;
private DelayedPowerTask enableTask;
private DelayedPowerTask disableTask;
private BukkitTask enableTask;
private BukkitTask disableTask;
private Block block;
private long delay = 0;
private long offDelay = 0;
@ -60,7 +61,7 @@ public class RedstoneSign extends DSign {
/**
* @return the enableTask
*/
public DelayedPowerTask getEnableTask() {
public BukkitTask getEnableTask() {
return enableTask;
}
@ -68,14 +69,14 @@ public class RedstoneSign extends DSign {
* @param enableTask
* the enableTask to set
*/
public void setEnableTask(DelayedPowerTask enableTask) {
public void setEnableTask(BukkitTask enableTask) {
this.enableTask = enableTask;
}
/**
* @return the disableTask
*/
public DelayedPowerTask getDisableTask() {
public BukkitTask getDisableTask() {
return disableTask;
}
@ -83,7 +84,7 @@ public class RedstoneSign extends DSign {
* @param disableTask
* the disableTask to set
*/
public void setDisableTask(DelayedPowerTask disableTask) {
public void setDisableTask(BukkitTask disableTask) {
this.disableTask = disableTask;
}
@ -209,11 +210,11 @@ public class RedstoneSign extends DSign {
}
if (delay > 0) {
enableTask = (DelayedPowerTask) new DelayedPowerTask(this, true).runTaskTimer(plugin, delay, delay + offDelay);
enableTask = new DelayedPowerTask(this, true).runTaskTimer(plugin, delay, delay + offDelay);
if (repeat != 1) {
repeatsToDo = repeat;
disableTask = (DelayedPowerTask) new DelayedPowerTask(this, false).runTaskTimer(plugin, delay + offDelay, delay + offDelay);
disableTask = new DelayedPowerTask(this, false).runTaskTimer(plugin, delay + offDelay, delay + offDelay);
}
} else {