fixed warnings in code
This commit is contained in:
parent
3e9edb8e68
commit
ceb4678179
@ -27,7 +27,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public final class CoswayUtil extends JavaPlugin {
|
public final class CoswayUtil extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@ -35,7 +35,6 @@ public final class CoswayUtil extends JavaPlugin {
|
|||||||
Bukkit.getPluginManager().registerEvents(new AnchorShield(), this);
|
Bukkit.getPluginManager().registerEvents(new AnchorShield(), this);
|
||||||
// Start the detection loop when the plugin is enabled
|
// Start the detection loop when the plugin is enabled
|
||||||
new AnchorShield().startDetectionLoop();
|
new AnchorShield().startDetectionLoop();
|
||||||
//getCommand("clearanchors").setExecutor(new ClearAnchorsCommand(this, anchorShield));
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -65,22 +64,20 @@ public final class CoswayUtil extends JavaPlugin {
|
|||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
serverMessage(ColorKey("&cim dead, im alive but im dead...."));
|
serverMessage(ColorKey("&cim dead, im alive but im dead...."));
|
||||||
}
|
}
|
||||||
public boolean onCommand(@NotNull CommandSender sender, Command cmd, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, Command cmd, @NotNull String label, String @NotNull [] args) {
|
||||||
if (cmd.getName().equalsIgnoreCase("scale") && sender instanceof Player) {
|
if (cmd.getName().equalsIgnoreCase("scale") && sender instanceof Player player) {
|
||||||
Player player = (Player) sender;
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
setScale(player, Float.parseFloat(args[0]));
|
setScale(player, Float.parseFloat(args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmd.getName().equalsIgnoreCase("throw") && sender instanceof Player) {
|
if (cmd.getName().equalsIgnoreCase("throw") && sender instanceof Player player) {
|
||||||
Player player = (Player) sender;
|
|
||||||
Player Target = getNearestPlayer(player,10);
|
Player Target = getNearestPlayer(player,10);
|
||||||
if(Target == null) {
|
if(Target == null) {
|
||||||
returnMsg(player,"&cNo players in radius");
|
returnMsg(player,"&cNo players in radius");
|
||||||
} else {
|
} else {
|
||||||
throwEntityAway(Target, player.getLocation(), 6);
|
throwEntityAway(Target, player.getLocation(), 8);
|
||||||
returnMsg(Target,"&cYou were thrown by "+player.getName());
|
returnMsg(Target,"&cYou were thrown by "+player.getName());
|
||||||
returnMsg(player,"&aYou threw "+Target.getName());
|
returnMsg(player,"&aYou threw "+Target.getName());
|
||||||
}
|
}
|
||||||
@ -99,7 +96,7 @@ public final class CoswayUtil extends JavaPlugin {
|
|||||||
player.getEyeLocation(),
|
player.getEyeLocation(),
|
||||||
player.getEyeLocation().getDirection(),
|
player.getEyeLocation().getDirection(),
|
||||||
10,
|
10,
|
||||||
entity -> entity instanceof Player == false // Ignore the player
|
entity -> !(entity instanceof Player) // Ignore the player
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result != null && result.getHitEntity() != null) {
|
if (result != null && result.getHitEntity() != null) {
|
||||||
@ -175,7 +172,6 @@ public final class CoswayUtil extends JavaPlugin {
|
|||||||
public class AnchorShield implements Listener {
|
public class AnchorShield implements Listener {
|
||||||
private final Map<Location, ArmorStand> activeAnchors = new HashMap<>();
|
private final Map<Location, ArmorStand> activeAnchors = new HashMap<>();
|
||||||
private final int RING_RADIUS = 25;
|
private final int RING_RADIUS = 25;
|
||||||
private final int FUEL_DECREASE_TIME = 10 * 60 * 20; // 5 minutes in ticks
|
|
||||||
boolean debug = false;
|
boolean debug = false;
|
||||||
public void debugMessage(String msg) {
|
public void debugMessage(String msg) {
|
||||||
if(debug) {
|
if(debug) {
|
||||||
@ -292,6 +288,8 @@ public final class CoswayUtil extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startFuelTimer(Location loc) {
|
private void startFuelTimer(Location loc) {
|
||||||
|
// 5 minutes in ticks
|
||||||
|
int FUEL_DECREASE_TIME = 10 * 60 * 20;
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
Loading…
Reference in New Issue
Block a user