Reformat code and remove unused SuppressWarnings
This commit is contained in:
@@ -11,7 +11,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class BeastMasterClass extends MineClassImpl {
|
||||
|
||||
private static final Set<Material> forbiddenItems =
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class DwarfClass extends MineClassImpl {
|
||||
|
||||
private final Set<Material> forbiddenItems =
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ElfClass extends MineClassImpl {
|
||||
|
||||
private static final Set<Material> forbiddenItems =
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class EnderElfClass extends MineClassImpl {
|
||||
|
||||
private static final Set<Material> forbiddenItems =
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class FireDwarfClass extends MineClassImpl {
|
||||
|
||||
private static final Set<Material> forbiddenItems =
|
||||
@@ -86,8 +85,7 @@ public class FireDwarfClass extends MineClassImpl {
|
||||
Material.CROSSBOW,
|
||||
Collections.singletonList(new Pair<>(Enchantment.ARROW_INFINITE, 1))),
|
||||
new AbstractMap.SimpleEntry<>(
|
||||
Material.FLINT_AND_STEEL, new ArrayList<Pair<Enchantment, Integer>>())
|
||||
)
|
||||
Material.FLINT_AND_STEEL, new ArrayList<Pair<Enchantment, Integer>>()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package net.babamod.mineclass.classes;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class MineClassFactory {
|
||||
/** Instance unique pré-initialisée */
|
||||
@@ -70,9 +68,7 @@ public class MineClassFactory {
|
||||
}
|
||||
|
||||
public synchronized void setClassCode(Player player, String code) {
|
||||
player
|
||||
.getScoreboardTags()
|
||||
.removeAll(availableClasses.keySet());
|
||||
player.getScoreboardTags().removeAll(availableClasses.keySet());
|
||||
player.addScoreboardTag(code);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public abstract class MineClassImpl implements MineClass {
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ package net.babamod.mineclass.commands;
|
||||
import net.babamod.mineclass.classes.MineClassFactory;
|
||||
import net.babamod.mineclass.utils.InvocationsFinder;
|
||||
import net.babamod.mineclass.utils.NumberOfInvocations;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
@@ -23,11 +23,15 @@ public class CommandClass implements CommandExecutor {
|
||||
Player player = (Player) sender;
|
||||
if (MineClassFactory.getInstance().getAvailableClassCodes().contains(args[0])) {
|
||||
if (MineClassFactory.getInstance().getClassCode(player).equals("beast_master")) {
|
||||
InvocationsFinder.findWolfs(player).forEach(entity -> {
|
||||
InvocationsFinder.findWolfs(player)
|
||||
.forEach(
|
||||
entity -> {
|
||||
entity.remove();
|
||||
NumberOfInvocations.getInstance().decreaseNumber(player);
|
||||
});
|
||||
InvocationsFinder.findCats(player).forEach(entity -> {
|
||||
InvocationsFinder.findCats(player)
|
||||
.forEach(
|
||||
entity -> {
|
||||
entity.remove();
|
||||
NumberOfInvocations.getInstance().decreaseNumber(player);
|
||||
});
|
||||
@@ -39,7 +43,7 @@ public class CommandClass implements CommandExecutor {
|
||||
MineClassFactory.getInstance().dropForbiddenItemsForClassByCode(args[0], player);
|
||||
MineClassFactory.getInstance().setClassCode(player, args[0]);
|
||||
if (!player.hasPotionEffect(PotionEffectType.SATURATION)) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION,200, 9));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 200, 9));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -49,8 +53,7 @@ public class CommandClass implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if (args[0].equals("whoami")) {
|
||||
String classCode =
|
||||
MineClassFactory.getInstance().getClassCode(player);
|
||||
String classCode = MineClassFactory.getInstance().getClassCode(player);
|
||||
if (classCode != null) {
|
||||
player.sendMessage(String.format("You are a %s.", classCode));
|
||||
} else {
|
||||
@@ -61,6 +64,4 @@ public class CommandClass implements CommandExecutor {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -295,9 +295,11 @@ public class MineClassListeners implements Listener {
|
||||
}
|
||||
}
|
||||
if (player.isSneaking()
|
||||
&& (event.getAction().equals(Action.RIGHT_CLICK_BLOCK) || event.getAction().equals(Action.RIGHT_CLICK_AIR))
|
||||
&& (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)
|
||||
|| event.getAction().equals(Action.RIGHT_CLICK_AIR))
|
||||
&& MineClassFactory.getInstance().getClassCode(player).equals("ender_elf")
|
||||
&& event.getItem() != null && event.getItem().getType().equals(Material.ENDER_PEARL)) {
|
||||
&& event.getItem() != null
|
||||
&& event.getItem().getType().equals(Material.ENDER_PEARL)) {
|
||||
player.openInventory(player.getEnderChest());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@@ -44,5 +44,4 @@ public class NumberOfInvocations {
|
||||
}
|
||||
numberOfInvocations.put(playerName, integer - 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user