mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Minor Code Optimizations
This commit is contained in:
parent
7c011d916a
commit
2812b84ea8
@ -73,7 +73,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
||||
private static final ItemStack[] fish = new ItemStack[] {new ItemStack(Material.COD), new ItemStack(Material.SALMON), new ItemStack(Material.PUFFERFISH), new ItemStack(Material.TROPICAL_FISH), new ItemStack(Material.STRING), new ItemStack(Material.BONE), new ItemStack(Material.STICK)};
|
||||
|
||||
private static final List<BlockFace> directions = Arrays.asList(BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST);
|
||||
private static final List<Material> blockblacklist = new ArrayList<Material>();
|
||||
private static final List<Material> blockblacklist = new ArrayList<>();
|
||||
|
||||
static {
|
||||
blockblacklist.add(Material.BEDROCK);
|
||||
@ -85,7 +85,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
|
||||
blockblacklist.add(Material.STRUCTURE_BLOCK);
|
||||
}
|
||||
|
||||
private Set<MachineFuel> recipes = new HashSet<MachineFuel>();
|
||||
private Set<MachineFuel> recipes = new HashSet<>();
|
||||
|
||||
public String getInventoryTitle() {
|
||||
return "Programmable Android";
|
||||
|
@ -42,9 +42,9 @@ public class SlimefunCommand implements CommandExecutor, Listener {
|
||||
|
||||
public SlimefunStartup plugin;
|
||||
|
||||
public static List<String> arguments = new ArrayList<String>();
|
||||
public static List<String> descriptions = new ArrayList<String>();
|
||||
public static List<String> tabs = new ArrayList<String>();
|
||||
public static List<String> arguments = new ArrayList<>();
|
||||
public static List<String> descriptions = new ArrayList<>();
|
||||
public static List<String> tabs = new ArrayList<>();
|
||||
|
||||
public SlimefunCommand(SlimefunStartup plugin) {
|
||||
this.plugin = plugin;
|
||||
@ -92,7 +92,6 @@ public class SlimefunCommand implements CommandExecutor, Listener {
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (args.length == 0) {
|
||||
|
@ -12,7 +12,7 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
||||
public class OreGenSystem {
|
||||
|
||||
public static Map<String, OreGenResource> map = new HashMap<String, OreGenResource>();
|
||||
public static Map<String, OreGenResource> map = new HashMap<>();
|
||||
|
||||
public static Collection<OreGenResource> listResources() {
|
||||
return map.values();
|
||||
|
@ -21,7 +21,7 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
||||
public class Elevator {
|
||||
|
||||
public static List<UUID> ignored = new ArrayList<UUID>();
|
||||
public static List<UUID> ignored = new ArrayList<>();
|
||||
|
||||
public static void openEditor(Player p, final Block b) {
|
||||
ChestMenu menu = new ChestMenu("Elevator Settings");
|
||||
@ -57,6 +57,7 @@ public class Elevator {
|
||||
ignored.remove(p.getUniqueId());
|
||||
return;
|
||||
}
|
||||
|
||||
TellRawMessage tellraw = new TellRawMessage();
|
||||
tellraw.addText("&3- Pick a Destination -\n\n");
|
||||
int index = 1;
|
||||
|
@ -31,12 +31,12 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class GPSNetwork {
|
||||
|
||||
private Map<UUID, Set<Location>> transmitters = new HashMap<UUID, Set<Location>>();
|
||||
private Map<UUID, Set<Location>> transmitters = new HashMap<>();
|
||||
private int[] border = new int[] {0, 1, 3, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53};
|
||||
private int[] inventory = new int[] {19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43};
|
||||
|
||||
public void updateTransmitter(Block b, UUID uuid, NetworkStatus status) {
|
||||
Set<Location> set = new HashSet<Location>();
|
||||
Set<Location> set = new HashSet<>();
|
||||
if (transmitters.containsKey(uuid)) set = transmitters.get(uuid);
|
||||
if (status.equals(NetworkStatus.ONLINE)) {
|
||||
if (!set.contains(b.getLocation())) {
|
||||
@ -111,6 +111,7 @@ public class GPSNetwork {
|
||||
|
||||
public static ItemStack getPlanet(Map.Entry<String, Location> entry) throws Exception {
|
||||
Location l = entry.getValue();
|
||||
|
||||
if (entry.getKey().startsWith("&4Deathpoint")) {
|
||||
return CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWFlMzg1NWY5NTJjZDRhMDNjMTQ4YTk0NmUzZjgxMmE1OTU1YWQzNWNiY2I1MjYyN2VhNGFjZDQ3ZDMwODEifX19");
|
||||
}
|
||||
@ -184,7 +185,7 @@ public class GPSNetwork {
|
||||
}
|
||||
|
||||
public Map<String, Location> getWaypoints(UUID uuid) {
|
||||
Map<String, Location> map = new HashMap<String, Location>();
|
||||
Map<String, Location> map = new HashMap<>();
|
||||
Config cfg = new Config("data-storage/Slimefun/waypoints/" + uuid.toString() + ".yml");
|
||||
for (String key: cfg.getKeys()) {
|
||||
if (cfg.contains(key + ".world") && Bukkit.getWorld(cfg.getString(key + ".world")) != null) {
|
||||
|
@ -19,7 +19,7 @@ import me.mrCookieSlime.Slimefun.SlimefunStartup;
|
||||
|
||||
public class TeleportationSequence {
|
||||
|
||||
public static Set<UUID> players = new HashSet<UUID>();
|
||||
public static Set<UUID> players = new HashSet<>();
|
||||
|
||||
public static void start(UUID uuid, int complexity, Location source, Location destination, boolean resistance) {
|
||||
players.add(uuid);
|
||||
|
@ -15,7 +15,7 @@ public class ItemHash {
|
||||
|
||||
public static MessageDigest digest;
|
||||
public static int LENGTH;
|
||||
public static Map<String, SlimefunItem> map = new HashMap<String, SlimefunItem>();
|
||||
public static Map<String, SlimefunItem> map = new HashMap<>();
|
||||
|
||||
static {
|
||||
try {
|
||||
|
@ -48,12 +48,12 @@ public class Research {
|
||||
* @since 4.0
|
||||
* @see ResearchSetup
|
||||
*/
|
||||
public static List<Research> list = new ArrayList<Research>();
|
||||
public static List<Research> list = new ArrayList<>();
|
||||
/**
|
||||
* Contains all the players (UUIDs) that are currently unlocking a research.
|
||||
* @since 4.0
|
||||
*/
|
||||
public static List<UUID> researching = new ArrayList<UUID>();
|
||||
public static List<UUID> researching = new ArrayList<>();
|
||||
/**
|
||||
* Whether researching in creative is free.
|
||||
* @since 4.0
|
||||
@ -87,7 +87,7 @@ public class Research {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.cost = cost;
|
||||
this.items = new ArrayList<SlimefunItem>();
|
||||
this.items = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunRecipes;
|
||||
|
||||
public class MiscSetup {
|
||||
|
||||
public static List<PostSlimefunLoadingHandler> post_handlers = new ArrayList<PostSlimefunLoadingHandler>();
|
||||
public static List<PostSlimefunLoadingHandler> post_handlers = new ArrayList<>();
|
||||
|
||||
public static void setupMisc() {
|
||||
if (SlimefunItem.getByID("COMMON_TALISMAN") != null && (Boolean) Slimefun.getItemValue("COMMON_TALISMAN", "recipe-requires-nether-stars")) {
|
||||
@ -45,7 +45,6 @@ public class MiscSetup {
|
||||
}
|
||||
|
||||
public static void loadItems() {
|
||||
|
||||
Iterator<SlimefunItem> iterator = SlimefunItem.items.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
SlimefunItem item = iterator.next();
|
||||
@ -59,9 +58,9 @@ public class MiscSetup {
|
||||
}
|
||||
}
|
||||
|
||||
List<SlimefunItem> pre = new ArrayList<SlimefunItem>();
|
||||
List<SlimefunItem> init = new ArrayList<SlimefunItem>();
|
||||
List<SlimefunItem> post = new ArrayList<SlimefunItem>();
|
||||
List<SlimefunItem> pre = new ArrayList<>();
|
||||
List<SlimefunItem> init = new ArrayList<>();
|
||||
List<SlimefunItem> post = new ArrayList<>();
|
||||
|
||||
for (SlimefunItem item: SlimefunItem.list()) {
|
||||
if (item instanceof Alloy || item instanceof ReplacingAlloy) pre.add(item);
|
||||
@ -157,7 +156,7 @@ public class MiscSetup {
|
||||
if (input == null) input = recipe;
|
||||
else {
|
||||
if (input[0] != null && recipe[0] != null) {
|
||||
List<ItemStack> inputs = new ArrayList<ItemStack>();
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
boolean dust = false;
|
||||
for (ItemStack i: input) {
|
||||
if (i != null) {
|
||||
|
@ -16,63 +16,63 @@ public class ResearchSetup {
|
||||
Slimefun.registerResearch(new Research(4, "Portable Dustbin", 2), SlimefunItems.PORTABLE_DUSTBIN);
|
||||
Slimefun.registerResearch(new Research(5, "Beef Jerky", 2), SlimefunItems.BEEF_JERKY);
|
||||
Slimefun.registerResearch(new Research(6, "Armor Crafting", 2), SlimefunItems.ARMOR_FORGE);
|
||||
Slimefun.registerResearch(new Research(8, "Lumps and Magic", 3), new ItemStack[] {SlimefunItems.MAGIC_LUMP_1, SlimefunItems.MAGIC_LUMP_2, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ENDER_LUMP_1, SlimefunItems.ENDER_LUMP_2, SlimefunItems.ENDER_LUMP_3});
|
||||
Slimefun.registerResearch(new Research(9, "Ender Backpack", 4), new ItemStack[] {SlimefunItems.ENDER_BACKPACK});
|
||||
Slimefun.registerResearch(new Research(7, "Glowstone Armor", 3), new ItemStack[] {SlimefunItems.GLOWSTONE_HELMET, SlimefunItems.GLOWSTONE_CHESTPLATE, SlimefunItems.GLOWSTONE_LEGGINGS, SlimefunItems.GLOWSTONE_BOOTS});
|
||||
Slimefun.registerResearch(new Research(10, "Ender Armor", 4), new ItemStack[] {SlimefunItems.ENDER_HELMET, SlimefunItems.ENDER_CHESTPLATE, SlimefunItems.ENDER_LEGGINGS, SlimefunItems.ENDER_BOOTS});
|
||||
Slimefun.registerResearch(new Research(11, "Magic Eye of Ender", 4), new ItemStack[] {SlimefunItems.MAGIC_EYE_OF_ENDER});
|
||||
Slimefun.registerResearch(new Research(12, "Magic Sugar", 4), new ItemStack[] {SlimefunItems.MAGIC_SUGAR});
|
||||
Slimefun.registerResearch(new Research(13, "Monster Jerky", 5), new ItemStack[] {SlimefunItems.MONSTER_JERKY});
|
||||
Slimefun.registerResearch(new Research(14, "Slime Armor", 5), new ItemStack[] {SlimefunItems.SLIME_HELMET, SlimefunItems.SLIME_CHESTPLATE, SlimefunItems.SLIME_LEGGINGS, SlimefunItems.SLIME_BOOTS});
|
||||
Slimefun.registerResearch(new Research(15, "Sword of Beheading", 6), new ItemStack[] {SlimefunItems.SWORD_OF_BEHEADING});
|
||||
Slimefun.registerResearch(new Research(16, "Electric Work", 8), new ItemStack[] {SlimefunItems.BASIC_CIRCUIT_BOARD});
|
||||
Slimefun.registerResearch(new Research(17, "Advanced Electricity", 9), new ItemStack[] {SlimefunItems.ADVANCED_CIRCUIT_BOARD});
|
||||
Slimefun.registerResearch(new Research(18, "Hot Smelting", 10), new ItemStack[] {SlimefunItems.SMELTERY});
|
||||
Slimefun.registerResearch(new Research(19, "Steel Age", 11), new ItemStack[] {SlimefunItems.STEEL_INGOT});
|
||||
Slimefun.registerResearch(new Research(20, "Important Power-Related Items", 12), new ItemStack[] {SlimefunItems.SULFATE, SlimefunItems.POWER_CRYSTAL});
|
||||
Slimefun.registerResearch(new Research(21, "Your first Battery", 10), new ItemStack[] {SlimefunItems.BATTERY});
|
||||
Slimefun.registerResearch(new Research(22, "Steel Plating", 14), new ItemStack[] {SlimefunItems.STEEL_PLATE});
|
||||
Slimefun.registerResearch(new Research(23, "Steel Thruster", 14), new ItemStack[] {SlimefunItems.STEEL_THRUSTER});
|
||||
Slimefun.registerResearch(new Research(24, "Parachute", 15), new ItemStack[] {SlimefunItems.PARACHUTE});
|
||||
Slimefun.registerResearch(new Research(25, "Grappling Hook", 15), new ItemStack[] {SlimefunItems.GRAPPLING_HOOK, SlimefunItems.HOOK, SlimefunItems.CHAIN});
|
||||
Slimefun.registerResearch(new Research(26, "Jetpacks", 22), new ItemStack[] {SlimefunItems.DURALUMIN_JETPACK, SlimefunItems.BILLON_JETPACK, SlimefunItems.SOLDER_JETPACK, SlimefunItems.STEEL_JETPACK, SlimefunItems.DAMASCUS_STEEL_JETPACK, SlimefunItems.REINFORCED_ALLOY_JETPACK});
|
||||
Slimefun.registerResearch(new Research(27, "Multi Tools", 18), new ItemStack[] {SlimefunItems.DURALUMIN_MULTI_TOOL, SlimefunItems.SOLDER_MULTI_TOOL, SlimefunItems.BILLON_MULTI_TOOL, SlimefunItems.STEEL_MULTI_TOOL, SlimefunItems.DAMASCUS_STEEL_MULTI_TOOL, SlimefunItems.REINFORCED_ALLOY_MULTI_TOOL});
|
||||
Slimefun.registerResearch(new Research(28, "Solar Power", 17), new ItemStack[] {SlimefunItems.SOLAR_PANEL, SlimefunItems.SOLAR_HELMET});
|
||||
Slimefun.registerResearch(new Research(29, "Elemental Staves", 17), new ItemStack[] {SlimefunItems.STAFF_ELEMENTAL});
|
||||
Slimefun.registerResearch(new Research(30, "Grind Stone", 4), new ItemStack[] {SlimefunItems.GRIND_STONE});
|
||||
Slimefun.registerResearch(new Research(31, "Cactus Suit", 5), new ItemStack[] {SlimefunItems.CACTUS_BOOTS, SlimefunItems.CACTUS_CHESTPLATE, SlimefunItems.CACTUS_HELMET, SlimefunItems.CACTUS_LEGGINGS});
|
||||
Slimefun.registerResearch(new Research(32, "Gold Pan", 5), new ItemStack[] {SlimefunItems.GOLD_PAN});
|
||||
Slimefun.registerResearch(new Research(33, "Magical Book Binding", 5), new ItemStack[] {SlimefunItems.MAGICAL_BOOK_COVER});
|
||||
Slimefun.registerResearch(new Research(34, "New Metals", 6), new ItemStack[] {SlimefunItems.COPPER_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.ALUMINUM_INGOT, SlimefunItems.ZINC_INGOT, SlimefunItems.MAGNESIUM_INGOT});
|
||||
Slimefun.registerResearch(new Research(35, "Ore Doubling", 6), new ItemStack[] {SlimefunItems.ORE_CRUSHER});
|
||||
Slimefun.registerResearch(new Research(36, "Bronze Creation", 8), new ItemStack[] {SlimefunItems.BRONZE_INGOT});
|
||||
Slimefun.registerResearch(new Research(37, "Advanced Alloys", 12), new ItemStack[] {SlimefunItems.BILLON_INGOT, SlimefunItems.DURALUMIN_INGOT, SlimefunItems.ALUMINUM_BRASS_INGOT, SlimefunItems.ALUMINUM_BRONZE_INGOT, SlimefunItems.SOLDER_INGOT, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.BRASS_INGOT});
|
||||
Slimefun.registerResearch(new Research(38, "Carbon Creation", 9), new ItemStack[] {SlimefunItems.COMPRESSOR, SlimefunItems.CARBON});
|
||||
Slimefun.registerResearch(new Research(39, "Bakery Innovation", 1), new ItemStack[] {SlimefunItems.WHEAT_FLOUR});
|
||||
Slimefun.registerResearch(new Research(40, "Gilded Iron Armor", 16), new ItemStack[] {SlimefunItems.GILDED_IRON_HELMET, SlimefunItems.GILDED_IRON_CHESTPLATE, SlimefunItems.GILDED_IRON_LEGGINGS, SlimefunItems.GILDED_IRON_BOOTS});
|
||||
Slimefun.registerResearch(new Research(41, "Synthetic Diamonds", 10), new ItemStack[] {SlimefunItems.COMPRESSED_CARBON, SlimefunItems.CARBON_CHUNK, SlimefunItems.SYNTHETIC_DIAMOND});
|
||||
Slimefun.registerResearch(new Research(42, "Pressure Chamber", 14), new ItemStack[] {SlimefunItems.PRESSURE_CHAMBER});
|
||||
Slimefun.registerResearch(new Research(43, "Synthetic Sapphires", 16), new ItemStack[] {SlimefunItems.SYNTHETIC_SAPPHIRE});
|
||||
Slimefun.registerResearch(new Research(45, "Damascus Steel", 17), new ItemStack[] {SlimefunItems.DAMASCUS_STEEL_INGOT});
|
||||
Slimefun.registerResearch(new Research(46, "Damascus Steel Armor", 18), new ItemStack[] {SlimefunItems.DAMASCUS_STEEL_HELMET, SlimefunItems.DAMASCUS_STEEL_CHESTPLATE, SlimefunItems.DAMASCUS_STEEL_LEGGINGS, SlimefunItems.DAMASCUS_STEEL_BOOTS});
|
||||
Slimefun.registerResearch(new Research(47, "Reinforced Alloy", 22), new ItemStack[] {SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.REINFORCED_ALLOY_INGOT});
|
||||
Slimefun.registerResearch(new Research(48, "Black Diamonds", 26), new ItemStack[] {SlimefunItems.RAW_CARBONADO, SlimefunItems.CARBONADO});
|
||||
Slimefun.registerResearch(new Research(50, "Magic Workbench", 12), new ItemStack[] {SlimefunItems.MAGIC_WORKBENCH});
|
||||
Slimefun.registerResearch(new Research(51, "Wind Staff", 17), new ItemStack[] {SlimefunItems.STAFF_WIND});
|
||||
Slimefun.registerResearch(new Research(52, "Reinforced Armor", 26), new ItemStack[] {SlimefunItems.REINFORCED_ALLOY_HELMET, SlimefunItems.REINFORCED_ALLOY_CHESTPLATE, SlimefunItems.REINFORCED_ALLOY_LEGGINGS, SlimefunItems.REINFORCED_ALLOY_BOOTS});
|
||||
Slimefun.registerResearch(new Research(53, "Ore Washer", 5), new ItemStack[] {SlimefunItems.ORE_WASHER, SlimefunItems.STONE_CHUNK, SlimefunItems.SIFTED_ORE});
|
||||
Slimefun.registerResearch(new Research(54, "Pure Gold", 7), new ItemStack[] {SlimefunItems.GOLD_4K, SlimefunItems.GOLD_6K, SlimefunItems.GOLD_8K, SlimefunItems.GOLD_10K, SlimefunItems.GOLD_12K, SlimefunItems.GOLD_14K, SlimefunItems.GOLD_16K, SlimefunItems.GOLD_18K, SlimefunItems.GOLD_20K, SlimefunItems.GOLD_22K, SlimefunItems.GOLD_24K});
|
||||
Slimefun.registerResearch(new Research(55, "Silicon Valley", 12), new ItemStack[] {SlimefunItems.SILICON, SlimefunItems.FERROSILICON});
|
||||
Slimefun.registerResearch(new Research(56, "Fire Staff", 2), new ItemStack[] {SlimefunItems.STAFF_FIRE});
|
||||
Slimefun.registerResearch(new Research(57, "Smelters Pickaxe", 17), new ItemStack[] {SlimefunItems.AUTO_SMELT_PICKAXE});
|
||||
Slimefun.registerResearch(new Research(58, "Common Talisman", 14), new ItemStack[] {SlimefunItems.TALISMAN});
|
||||
Slimefun.registerResearch(new Research(59, "Talisman of the Anvil", 18), new ItemStack[] {SlimefunItems.TALISMAN_ANVIL});
|
||||
Slimefun.registerResearch(new Research(60, "Talisman of the Miner", 18), new ItemStack[] {SlimefunItems.TALISMAN_MINER});
|
||||
Slimefun.registerResearch(new Research(61, "Talisman of the Hunter", 18), new ItemStack[] {SlimefunItems.TALISMAN_HUNTER});
|
||||
Slimefun.registerResearch(new Research(62, "Talisman of the Lava Walker", 18), new ItemStack[] {SlimefunItems.TALISMAN_LAVA});
|
||||
Slimefun.registerResearch(new Research(63, "Talisman of the Water Breather", 18), new ItemStack[] {SlimefunItems.TALISMAN_WATER});
|
||||
Slimefun.registerResearch(new Research(64, "Talisman of the Angel", 18), new ItemStack[] {SlimefunItems.TALISMAN_ANGEL});
|
||||
Slimefun.registerResearch(new Research(65, "Talisman of the Firefighter", 18), new ItemStack[] {SlimefunItems.TALISMAN_FIRE});
|
||||
Slimefun.registerResearch(new Research(8, "Lumps and Magic", 3), SlimefunItems.MAGIC_LUMP_1, SlimefunItems.MAGIC_LUMP_2, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ENDER_LUMP_1, SlimefunItems.ENDER_LUMP_2, SlimefunItems.ENDER_LUMP_3);
|
||||
Slimefun.registerResearch(new Research(9, "Ender Backpack", 4), SlimefunItems.ENDER_BACKPACK);
|
||||
Slimefun.registerResearch(new Research(7, "Glowstone Armor", 3), SlimefunItems.GLOWSTONE_HELMET, SlimefunItems.GLOWSTONE_CHESTPLATE, SlimefunItems.GLOWSTONE_LEGGINGS, SlimefunItems.GLOWSTONE_BOOTS);
|
||||
Slimefun.registerResearch(new Research(10, "Ender Armor", 4), SlimefunItems.ENDER_HELMET, SlimefunItems.ENDER_CHESTPLATE, SlimefunItems.ENDER_LEGGINGS, SlimefunItems.ENDER_BOOTS);
|
||||
Slimefun.registerResearch(new Research(11, "Magic Eye of Ender", 4), SlimefunItems.MAGIC_EYE_OF_ENDER);
|
||||
Slimefun.registerResearch(new Research(12, "Magic Sugar", 4), SlimefunItems.MAGIC_SUGAR);
|
||||
Slimefun.registerResearch(new Research(13, "Monster Jerky", 5), SlimefunItems.MONSTER_JERKY);
|
||||
Slimefun.registerResearch(new Research(14, "Slime Armor", 5), SlimefunItems.SLIME_HELMET, SlimefunItems.SLIME_CHESTPLATE, SlimefunItems.SLIME_LEGGINGS, SlimefunItems.SLIME_BOOTS);
|
||||
Slimefun.registerResearch(new Research(15, "Sword of Beheading", 6), SlimefunItems.SWORD_OF_BEHEADING);
|
||||
Slimefun.registerResearch(new Research(16, "Electric Work", 8), SlimefunItems.BASIC_CIRCUIT_BOARD);
|
||||
Slimefun.registerResearch(new Research(17, "Advanced Electricity", 9), SlimefunItems.ADVANCED_CIRCUIT_BOARD);
|
||||
Slimefun.registerResearch(new Research(18, "Hot Smelting", 10), SlimefunItems.SMELTERY);
|
||||
Slimefun.registerResearch(new Research(19, "Steel Age", 11), SlimefunItems.STEEL_INGOT);
|
||||
Slimefun.registerResearch(new Research(20, "Important Power-Related Items", 12), SlimefunItems.SULFATE, SlimefunItems.POWER_CRYSTAL);
|
||||
Slimefun.registerResearch(new Research(21, "Your first Battery", 10), SlimefunItems.BATTERY);
|
||||
Slimefun.registerResearch(new Research(22, "Steel Plating", 14), SlimefunItems.STEEL_PLATE);
|
||||
Slimefun.registerResearch(new Research(23, "Steel Thruster", 14), SlimefunItems.STEEL_THRUSTER);
|
||||
Slimefun.registerResearch(new Research(24, "Parachute", 15), SlimefunItems.PARACHUTE);
|
||||
Slimefun.registerResearch(new Research(25, "Grappling Hook", 15), SlimefunItems.GRAPPLING_HOOK, SlimefunItems.HOOK, SlimefunItems.CHAIN);
|
||||
Slimefun.registerResearch(new Research(26, "Jetpacks", 22), SlimefunItems.DURALUMIN_JETPACK, SlimefunItems.BILLON_JETPACK, SlimefunItems.SOLDER_JETPACK, SlimefunItems.STEEL_JETPACK, SlimefunItems.DAMASCUS_STEEL_JETPACK, SlimefunItems.REINFORCED_ALLOY_JETPACK);
|
||||
Slimefun.registerResearch(new Research(27, "Multi Tools", 18), SlimefunItems.DURALUMIN_MULTI_TOOL, SlimefunItems.SOLDER_MULTI_TOOL, SlimefunItems.BILLON_MULTI_TOOL, SlimefunItems.STEEL_MULTI_TOOL, SlimefunItems.DAMASCUS_STEEL_MULTI_TOOL, SlimefunItems.REINFORCED_ALLOY_MULTI_TOOL);
|
||||
Slimefun.registerResearch(new Research(28, "Solar Power", 17), SlimefunItems.SOLAR_PANEL, SlimefunItems.SOLAR_HELMET);
|
||||
Slimefun.registerResearch(new Research(29, "Elemental Staves", 17), SlimefunItems.STAFF_ELEMENTAL);
|
||||
Slimefun.registerResearch(new Research(30, "Grind Stone", 4), SlimefunItems.GRIND_STONE);
|
||||
Slimefun.registerResearch(new Research(31, "Cactus Suit", 5), SlimefunItems.CACTUS_BOOTS, SlimefunItems.CACTUS_CHESTPLATE, SlimefunItems.CACTUS_HELMET, SlimefunItems.CACTUS_LEGGINGS);
|
||||
Slimefun.registerResearch(new Research(32, "Gold Pan", 5), SlimefunItems.GOLD_PAN);
|
||||
Slimefun.registerResearch(new Research(33, "Magical Book Binding", 5), SlimefunItems.MAGICAL_BOOK_COVER);
|
||||
Slimefun.registerResearch(new Research(34, "New Metals", 6), SlimefunItems.COPPER_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.LEAD_INGOT, SlimefunItems.ALUMINUM_INGOT, SlimefunItems.ZINC_INGOT, SlimefunItems.MAGNESIUM_INGOT);
|
||||
Slimefun.registerResearch(new Research(35, "Ore Doubling", 6), SlimefunItems.ORE_CRUSHER);
|
||||
Slimefun.registerResearch(new Research(36, "Bronze Creation", 8), SlimefunItems.BRONZE_INGOT);
|
||||
Slimefun.registerResearch(new Research(37, "Advanced Alloys", 12), SlimefunItems.BILLON_INGOT, SlimefunItems.DURALUMIN_INGOT, SlimefunItems.ALUMINUM_BRASS_INGOT, SlimefunItems.ALUMINUM_BRONZE_INGOT, SlimefunItems.SOLDER_INGOT, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.BRASS_INGOT);
|
||||
Slimefun.registerResearch(new Research(38, "Carbon Creation", 9), SlimefunItems.COMPRESSOR, SlimefunItems.CARBON);
|
||||
Slimefun.registerResearch(new Research(39, "Bakery Innovation", 1), SlimefunItems.WHEAT_FLOUR);
|
||||
Slimefun.registerResearch(new Research(40, "Gilded Iron Armor", 16), SlimefunItems.GILDED_IRON_HELMET, SlimefunItems.GILDED_IRON_CHESTPLATE, SlimefunItems.GILDED_IRON_LEGGINGS, SlimefunItems.GILDED_IRON_BOOTS);
|
||||
Slimefun.registerResearch(new Research(41, "Synthetic Diamonds", 10), SlimefunItems.COMPRESSED_CARBON, SlimefunItems.CARBON_CHUNK, SlimefunItems.SYNTHETIC_DIAMOND);
|
||||
Slimefun.registerResearch(new Research(42, "Pressure Chamber", 14), SlimefunItems.PRESSURE_CHAMBER);
|
||||
Slimefun.registerResearch(new Research(43, "Synthetic Sapphires", 16), SlimefunItems.SYNTHETIC_SAPPHIRE);
|
||||
Slimefun.registerResearch(new Research(45, "Damascus Steel", 17), SlimefunItems.DAMASCUS_STEEL_INGOT);
|
||||
Slimefun.registerResearch(new Research(46, "Damascus Steel Armor", 18), SlimefunItems.DAMASCUS_STEEL_HELMET, SlimefunItems.DAMASCUS_STEEL_CHESTPLATE, SlimefunItems.DAMASCUS_STEEL_LEGGINGS, SlimefunItems.DAMASCUS_STEEL_BOOTS);
|
||||
Slimefun.registerResearch(new Research(47, "Reinforced Alloy", 22), SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.REINFORCED_ALLOY_INGOT);
|
||||
Slimefun.registerResearch(new Research(48, "Black Diamonds", 26), SlimefunItems.RAW_CARBONADO, SlimefunItems.CARBONADO);
|
||||
Slimefun.registerResearch(new Research(50, "Magic Workbench", 12), SlimefunItems.MAGIC_WORKBENCH);
|
||||
Slimefun.registerResearch(new Research(51, "Wind Staff", 17), SlimefunItems.STAFF_WIND);
|
||||
Slimefun.registerResearch(new Research(52, "Reinforced Armor", 26), SlimefunItems.REINFORCED_ALLOY_HELMET, SlimefunItems.REINFORCED_ALLOY_CHESTPLATE, SlimefunItems.REINFORCED_ALLOY_LEGGINGS, SlimefunItems.REINFORCED_ALLOY_BOOTS);
|
||||
Slimefun.registerResearch(new Research(53, "Ore Washer", 5), SlimefunItems.ORE_WASHER, SlimefunItems.STONE_CHUNK, SlimefunItems.SIFTED_ORE);
|
||||
Slimefun.registerResearch(new Research(54, "Pure Gold", 7), SlimefunItems.GOLD_4K, SlimefunItems.GOLD_6K, SlimefunItems.GOLD_8K, SlimefunItems.GOLD_10K, SlimefunItems.GOLD_12K, SlimefunItems.GOLD_14K, SlimefunItems.GOLD_16K, SlimefunItems.GOLD_18K, SlimefunItems.GOLD_20K, SlimefunItems.GOLD_22K, SlimefunItems.GOLD_24K);
|
||||
Slimefun.registerResearch(new Research(55, "Silicon Valley", 12), SlimefunItems.SILICON, SlimefunItems.FERROSILICON);
|
||||
Slimefun.registerResearch(new Research(56, "Fire Staff", 2), SlimefunItems.STAFF_FIRE);
|
||||
Slimefun.registerResearch(new Research(57, "Smelters Pickaxe", 17), SlimefunItems.AUTO_SMELT_PICKAXE);
|
||||
Slimefun.registerResearch(new Research(58, "Common Talisman", 14), SlimefunItems.TALISMAN);
|
||||
Slimefun.registerResearch(new Research(59, "Talisman of the Anvil", 18), SlimefunItems.TALISMAN_ANVIL);
|
||||
Slimefun.registerResearch(new Research(60, "Talisman of the Miner", 18), SlimefunItems.TALISMAN_MINER);
|
||||
Slimefun.registerResearch(new Research(61, "Talisman of the Hunter", 18), SlimefunItems.TALISMAN_HUNTER);
|
||||
Slimefun.registerResearch(new Research(62, "Talisman of the Lava Walker", 18), SlimefunItems.TALISMAN_LAVA);
|
||||
Slimefun.registerResearch(new Research(63, "Talisman of the Water Breather", 18), SlimefunItems.TALISMAN_WATER);
|
||||
Slimefun.registerResearch(new Research(64, "Talisman of the Angel", 18), SlimefunItems.TALISMAN_ANGEL);
|
||||
Slimefun.registerResearch(new Research(65, "Talisman of the Firefighter", 18), SlimefunItems.TALISMAN_FIRE);
|
||||
Slimefun.registerResearch(new Research(67, "Firey Situation", 14), SlimefunItems.LAVA_CRYSTAL);
|
||||
Slimefun.registerResearch(new Research(68, "Talisman of the Magician", 20), SlimefunItems.TALISMAN_MAGICIAN);
|
||||
Slimefun.registerResearch(new Research(69, "Talisman of the Traveller", 20), SlimefunItems.TALISMAN_TRAVELLER);
|
||||
|
@ -7,7 +7,6 @@ import java.util.Map;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunStartup;
|
||||
@ -22,7 +21,7 @@ public class SlimefunManager {
|
||||
|
||||
public static SlimefunStartup plugin;
|
||||
public static String PREFIX;
|
||||
public static Map<EntityType, List<ItemStack>> drops = new HashMap<EntityType, List<ItemStack>>();
|
||||
public static Map<EntityType, List<ItemStack>> drops = new HashMap<>();
|
||||
|
||||
public static void registerArmorSet(ItemStack baseComponent, ItemStack[] items, String idSyntax, PotionEffect[][] effects, boolean special, boolean slimefun) {
|
||||
String[] components = new String[] {"_HELMET", "_CHESTPLATE", "_LEGGINGS", "_BOOTS"};
|
||||
|
@ -718,11 +718,11 @@ public class SlimefunSetup {
|
||||
for (ItemStack converting: inputs.get(i)) {
|
||||
if (converting != null) {
|
||||
for (int j = 0; j < inv.getContents().length; j++) {
|
||||
if (j == (inv.getContents().length - 1) && !SlimefunManager.isItemSimiliar(converting, inv.getContents()[j], true, SlimefunManager.DataType.ALWAYS)) {
|
||||
if (j == (inv.getContents().length - 1) && !SlimefunManager.isItemSimiliar(converting, inv.getContents()[j], true)) {
|
||||
craft = false;
|
||||
break;
|
||||
}
|
||||
else if (SlimefunManager.isItemSimiliar(inv.getContents()[j], converting, true, SlimefunManager.DataType.ALWAYS)) break;
|
||||
else if (SlimefunManager.isItemSimiliar(inv.getContents()[j], converting, true)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1089,13 +1089,13 @@ public class SlimefunSetup {
|
||||
@Override
|
||||
public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
|
||||
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.GRAPPLING_HOOK, true)) {
|
||||
if (e.getClickedBlock() == null && !Variables.jump.containsKey(p.getUniqueId())) {
|
||||
if (e.getClickedBlock() == null && !Variables.jump_state.containsKey(p.getUniqueId())) {
|
||||
e.setCancelled(true);
|
||||
if (p.getInventory().getItemInOffHand().getType().equals(Material.BOW)) {
|
||||
// Cancel, to fix dupe #740
|
||||
return false;
|
||||
}
|
||||
Variables.jump.put(p.getUniqueId(), p.getInventory().getItemInMainHand().getType() != Material.SHEARS);
|
||||
Variables.jump_state.put(p.getUniqueId(), p.getInventory().getItemInMainHand().getType() != Material.SHEARS);
|
||||
if (p.getInventory().getItemInMainHand().getType() == Material.LEAD) PlayerInventory.consumeItemInHand(p);
|
||||
|
||||
Vector direction = p.getEyeLocation().getDirection().multiply(2.0);
|
||||
@ -1108,7 +1108,7 @@ public class SlimefunSetup {
|
||||
b.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 100000));
|
||||
b.setLeashHolder(arrow);
|
||||
|
||||
Variables.damage.put(p.getUniqueId(), true);
|
||||
Variables.damage.add(p.getUniqueId());
|
||||
Variables.remove.put(p.getUniqueId(), new Entity[] {b, arrow});
|
||||
}
|
||||
return true;
|
||||
|
@ -40,8 +40,8 @@ import me.mrCookieSlime.Slimefun.Setup.MiscSetup;
|
||||
import me.mrCookieSlime.Slimefun.Setup.ResearchSetup;
|
||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunSetup;
|
||||
import me.mrCookieSlime.Slimefun.URID.AutoSavingTask;
|
||||
import me.mrCookieSlime.Slimefun.WorldEdit.WESlimefunManager;
|
||||
import me.mrCookieSlime.Slimefun.api.AutoSavingTask;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunBackup;
|
||||
@ -388,7 +388,7 @@ public class SlimefunStartup extends JavaPlugin {
|
||||
SlimefunItem.handlers = null;
|
||||
SlimefunItem.radioactive = null;
|
||||
Variables.damage = null;
|
||||
Variables.jump = null;
|
||||
Variables.jump_state = null;
|
||||
Variables.mode = null;
|
||||
SlimefunGuide.history = null;
|
||||
Variables.altarinuse = null;
|
||||
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -13,18 +14,18 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Variables {
|
||||
|
||||
public static Map<UUID, Boolean> jump = new HashMap<UUID, Boolean>();
|
||||
public static Map<UUID, Boolean> damage = new HashMap<UUID, Boolean>();
|
||||
public static Map<UUID, Entity[]> remove = new HashMap<UUID, Entity[]>();
|
||||
public static Map<UUID, Integer> mode = new HashMap<UUID, Integer>();
|
||||
public static Map<UUID, Boolean> jump_state = new HashMap<>();
|
||||
public static Set<UUID> damage = new HashSet<>();
|
||||
public static Map<UUID, Entity[]> remove = new HashMap<>();
|
||||
public static Map<UUID, Integer> mode = new HashMap<>();
|
||||
|
||||
public static Map<UUID, Integer> enchanting = new HashMap<UUID, Integer>();
|
||||
public static Map<UUID, ItemStack> backpack = new HashMap<UUID, ItemStack>();
|
||||
public static HashSet<Location> altarinuse = new HashSet<Location>();
|
||||
public static Map<UUID, Integer> enchanting = new HashMap<>();
|
||||
public static Map<UUID, ItemStack> backpack = new HashMap<>();
|
||||
public static HashSet<Location> altarinuse = new HashSet<>();
|
||||
|
||||
public static Map<UUID, List<ItemStack>> soulbound = new HashMap<UUID, List<ItemStack>>();
|
||||
public static List<UUID> blocks = new ArrayList<UUID>();
|
||||
public static List<UUID> cancelPlace = new ArrayList<UUID>();
|
||||
public static Map<UUID, ItemStack> arrows = new HashMap<UUID, ItemStack>();
|
||||
public static Map<UUID, List<ItemStack>> soulbound = new HashMap<>();
|
||||
public static List<UUID> blocks = new ArrayList<>();
|
||||
public static List<UUID> cancelPlace = new ArrayList<>();
|
||||
public static Map<UUID, ItemStack> arrows = new HashMap<>();
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package me.mrCookieSlime.Slimefun.URID;
|
||||
package me.mrCookieSlime.Slimefun.api;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -7,7 +7,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunStartup;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
||||
public class AutoSavingTask implements Runnable {
|
||||
|
@ -15,7 +15,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class Backpacks {
|
||||
|
||||
public static String createBackpack(Player p, int size) {
|
||||
List<Integer> ids = new ArrayList<Integer>();
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
Config cfg = new Config(new File("data-storage/Slimefun/Players/" + p.getUniqueId() + ".yml"));
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
if (cfg.contains("backpacks." + i + ".size")) ids.add(i);
|
||||
|
@ -11,26 +11,34 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
|
||||
public class BlockInfoConfig extends Config {
|
||||
|
||||
private Map<String, String> data;
|
||||
|
||||
public BlockInfoConfig() {
|
||||
this(new HashMap<>());
|
||||
}
|
||||
|
||||
public BlockInfoConfig(Map<String, String> data) {
|
||||
super((File)null,(FileConfiguration)null);
|
||||
this.data=data;
|
||||
}
|
||||
|
||||
public Map<String, String> getMap(){
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void store(String path, Object value) {
|
||||
if (value != null && !(value instanceof String)) {
|
||||
throw new UnsupportedOperationException("Can't set \""+path+"\" to \""+value+"\" (type: "+value.getClass().getSimpleName()+") because BlockInfoConfig only supports Strings");
|
||||
throw new UnsupportedOperationException("Can't set \"" + path + "\" to \"" + value + "\" (type: " + value.getClass().getSimpleName() + ") because BlockInfoConfig only supports Strings");
|
||||
}
|
||||
|
||||
checkPath(path);
|
||||
|
||||
if (value == null) {
|
||||
data.remove(path);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
data.put(path, (String) value);
|
||||
}
|
||||
}
|
||||
@ -38,7 +46,7 @@ public class BlockInfoConfig extends Config {
|
||||
|
||||
private void checkPath(String path) {
|
||||
if (path.contains(".")) {
|
||||
throw new UnsupportedOperationException("BlockInfoConfig only supports Map<String,String> (path: " + path+")");
|
||||
throw new UnsupportedOperationException("BlockInfoConfig only supports Map<String,String> (path: " + path + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +74,7 @@ public class BlockInfoConfig extends Config {
|
||||
}
|
||||
|
||||
private UnsupportedOperationException invalidType(String path) {
|
||||
return new UnsupportedOperationException("Can't get \""+path+"\" because BlockInfoConfig only supports String values");
|
||||
return new UnsupportedOperationException("Can't get \"" + path + "\" because BlockInfoConfig only supports String values");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,19 +35,19 @@ public class BlockStorage {
|
||||
private static final String path_blocks = "data-storage/Slimefun/stored-blocks/";
|
||||
private static final String path_chunks = "data-storage/Slimefun/stored-chunks/";
|
||||
|
||||
public static Map<String, BlockStorage> worlds = new HashMap<String, BlockStorage>();
|
||||
public static Map<String, Set<Location>> ticking_chunks = new HashMap<String, Set<Location>>();
|
||||
public static Set<String> loaded_tickers = new HashSet<String>();
|
||||
public static Map<String, BlockStorage> worlds = new HashMap<>();
|
||||
public static Map<String, Set<Location>> ticking_chunks = new HashMap<>();
|
||||
public static Set<String> loaded_tickers = new HashSet<>();
|
||||
|
||||
private World world;
|
||||
|
||||
private Map<Location, Config> storage = new HashMap<>();
|
||||
private static Map<String, String> map_chunks = new HashMap<String, String>();
|
||||
private static Map<String, String> map_chunks = new HashMap<>();
|
||||
|
||||
private Map<Location, BlockMenu> inventories = new HashMap<Location, BlockMenu>();
|
||||
public static Map<String, UniversalBlockMenu> universal_inventories = new HashMap<String, UniversalBlockMenu>();
|
||||
private Map<Location, BlockMenu> inventories = new HashMap<>();
|
||||
public static Map<String, UniversalBlockMenu> universal_inventories = new HashMap<>();
|
||||
|
||||
private Map<String, Config> cache_blocks = new HashMap<String, Config>();
|
||||
private Map<String, Config> cache_blocks = new HashMap<>();
|
||||
|
||||
public static int info_delay;
|
||||
|
||||
@ -93,7 +93,12 @@ public class BlockStorage {
|
||||
|
||||
try {
|
||||
for (File file: f.listFiles()) {
|
||||
if (file.getName().endsWith(".sfb")) {
|
||||
if (file.getName().equals("null.sfb")) {
|
||||
System.err.println("[Slimefun] Corrupted file detected!");
|
||||
System.err.println("[Slimefun] Slimefun will simply skip this File, but you");
|
||||
System.err.println("[Slimefun] should probably look into it!");
|
||||
}
|
||||
else if (file.getName().endsWith(".sfb")) {
|
||||
if (timestamp + info_delay < System.currentTimeMillis()) {
|
||||
System.out.println("[Slimefun] Loading Blocks... " + Math.round((((done * 100.0f) / total) * 100.0f) / 100.0f) + "% done (\"" + w.getName() + "\")");
|
||||
timestamp = System.currentTimeMillis();
|
||||
@ -191,12 +196,12 @@ public class BlockStorage {
|
||||
public void computeChanges() {
|
||||
changes = cache_blocks.size() + chunk_changes;
|
||||
|
||||
Map<Location, BlockMenu> inventories2 = new HashMap<Location, BlockMenu>(inventories);
|
||||
Map<Location, BlockMenu> inventories2 = new HashMap<>(inventories);
|
||||
for (Map.Entry<Location, BlockMenu> entry: inventories2.entrySet()) {
|
||||
changes += entry.getValue().changes;
|
||||
}
|
||||
|
||||
Map<String, UniversalBlockMenu> universal_inventories2 = new HashMap<String, UniversalBlockMenu>(universal_inventories);
|
||||
Map<String, UniversalBlockMenu> universal_inventories2 = new HashMap<>(universal_inventories);
|
||||
for (Map.Entry<String, UniversalBlockMenu> entry: universal_inventories2.entrySet()) {
|
||||
changes += entry.getValue().changes;
|
||||
}
|
||||
@ -217,7 +222,7 @@ public class BlockStorage {
|
||||
|
||||
System.out.println("[Slimefun] Saving Blocks for World \"" + world.getName() + "\" (" + changes + " Changes queued)");
|
||||
|
||||
Map<String, Config> cache = new HashMap<String, Config>(cache_blocks);
|
||||
Map<String, Config> cache = new HashMap<>(cache_blocks);
|
||||
|
||||
for (Map.Entry<String, Config> entry: cache.entrySet()) {
|
||||
cache_blocks.remove(entry.getKey());
|
||||
@ -235,13 +240,13 @@ public class BlockStorage {
|
||||
}
|
||||
}
|
||||
|
||||
Map<Location, BlockMenu> inventories2 = new HashMap<Location, BlockMenu>(inventories);
|
||||
Map<Location, BlockMenu> inventories2 = new HashMap<>(inventories);
|
||||
|
||||
for (Map.Entry<Location, BlockMenu> entry: inventories2.entrySet()) {
|
||||
entry.getValue().save(entry.getKey());
|
||||
}
|
||||
|
||||
Map<String, UniversalBlockMenu> universal_inventories2 = new HashMap<String, UniversalBlockMenu>(universal_inventories);
|
||||
Map<String, UniversalBlockMenu> universal_inventories2 = new HashMap<>(universal_inventories);
|
||||
|
||||
for (Map.Entry<String, UniversalBlockMenu> entry: universal_inventories2.entrySet()) {
|
||||
entry.getValue().save();
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class Soul {
|
||||
|
||||
public static void storeItem(UUID uuid, ItemStack drop) {
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
if (Variables.soulbound.containsKey(uuid)) items = Variables.soulbound.get(uuid);
|
||||
items.add(drop);
|
||||
Variables.soulbound.put(uuid, items);
|
||||
|
@ -23,26 +23,25 @@ public class TickerTask implements Runnable {
|
||||
|
||||
public boolean HALTED = false;
|
||||
|
||||
public Map<Location, Location> move = new HashMap<Location, Location>();
|
||||
public Map<Location, Boolean> delete = new HashMap<Location, Boolean>();
|
||||
public Map<Location, Location> move = new HashMap<>();
|
||||
public Map<Location, Boolean> delete = new HashMap<>();
|
||||
|
||||
private Set<BlockTicker> tickers = new HashSet<BlockTicker>();
|
||||
private Set<BlockTicker> tickers = new HashSet<>();
|
||||
|
||||
private int skipped = 0, chunks = 0, machines = 0;
|
||||
private long time = 0;
|
||||
private Map<String, Integer> map_chunk = new HashMap<String, Integer>();
|
||||
private Map<String, Integer> map_machine = new HashMap<String, Integer>();
|
||||
private Map<String, Long> map_machinetime = new HashMap<String, Long>();
|
||||
private Map<String, Long> map_chunktime = new HashMap<String, Long>();
|
||||
private Set<String> skipped_chunks = new HashSet<String>();
|
||||
private Map<String, Integer> map_chunk = new HashMap<>();
|
||||
private Map<String, Integer> map_machine = new HashMap<>();
|
||||
private Map<String, Long> map_machinetime = new HashMap<>();
|
||||
private Map<String, Long> map_chunktime = new HashMap<>();
|
||||
private Set<String> skipped_chunks = new HashSet<>();
|
||||
|
||||
public static Map<Location, Long> block_timings = new HashMap<Location, Long>();
|
||||
public static Map<Location, Long> block_timings = new HashMap<>();
|
||||
|
||||
public static Map<Location, Integer> bugged_blocks = new HashMap<Location, Integer>();
|
||||
public static Map<Location, Integer> bugged_blocks = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
long timestamp = System.currentTimeMillis();
|
||||
|
||||
skipped = 0;
|
||||
@ -56,10 +55,10 @@ public class TickerTask implements Runnable {
|
||||
map_machinetime.clear();
|
||||
block_timings.clear();
|
||||
|
||||
final Map<Location, Integer> bugged = new HashMap<Location, Integer>(bugged_blocks);
|
||||
final Map<Location, Integer> bugged = new HashMap<>(bugged_blocks);
|
||||
bugged_blocks.clear();
|
||||
|
||||
Map<Location, Boolean> remove = new HashMap<Location, Boolean>(delete);
|
||||
Map<Location, Boolean> remove = new HashMap<>(delete);
|
||||
|
||||
for (Map.Entry<Location, Boolean> entry: remove.entrySet()) {
|
||||
BlockStorage._integrated_removeBlockInfo(entry.getKey(), entry.getValue());
|
||||
@ -350,6 +349,7 @@ public class TickerTask implements Runnable {
|
||||
}
|
||||
hover.append("\n\n&c+ &4" + hidden + " Hidden");
|
||||
tellraw.addHoverEvent(HoverAction.SHOW_TEXT, hover.toString());
|
||||
|
||||
try {
|
||||
tellraw.send((Player) sender);
|
||||
} catch (Exception e) {
|
||||
@ -357,7 +357,6 @@ public class TickerTask implements Runnable {
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
int hidden = 0;
|
||||
for (String c: map_chunktime.keySet()) {
|
||||
if (!skipped_chunks.contains(c)) {
|
||||
|
@ -18,9 +18,9 @@ import org.bukkit.block.Skull;
|
||||
|
||||
public class ChargableBlock {
|
||||
|
||||
public static Map<String, Integer> max_charges = new HashMap<String, Integer>();
|
||||
public static Set<String> rechargeable = new HashSet<String>();
|
||||
public static Set<String> capacitors = new HashSet<String>();
|
||||
public static Map<String, Integer> max_charges = new HashMap<>();
|
||||
public static Set<String> rechargeable = new HashSet<>();
|
||||
public static Set<String> capacitors = new HashSet<>();
|
||||
|
||||
public static void registerChargableBlock(String id, int capacity, boolean recharge) {
|
||||
max_charges.put(id, capacity);
|
||||
|
@ -2,6 +2,7 @@ package me.mrCookieSlime.Slimefun.api.energy;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface EnergyFlowListener {
|
||||
|
||||
void onPulse(Block b);
|
||||
|
@ -23,7 +23,7 @@ public class CargoManager {
|
||||
UniversalBlockMenu menu = storage.getUniversalInventory(target);
|
||||
for (int slot: menu.getPreset().getSlotsAccessedByItemTransport(menu, ItemTransportFlow.WITHDRAW, null)) {
|
||||
final ItemStack is = menu.getItemInSlot(slot);
|
||||
if (SlimefunManager.isItemSimiliar(is, template, true, DataType.ALWAYS) && matchesFilter(node, is, -1)) {
|
||||
if (SlimefunManager.isItemSimiliar(is, template, true) && matchesFilter(node, is, -1)) {
|
||||
if (is.getAmount() > template.getAmount()) {
|
||||
menu.replaceExistingItem(slot, new CustomItem(is, is.getAmount() - template.getAmount()));
|
||||
return template;
|
||||
@ -39,7 +39,7 @@ public class CargoManager {
|
||||
BlockMenu menu = BlockStorage.getInventory(target.getLocation());
|
||||
for (int slot: menu.getPreset().getSlotsAccessedByItemTransport(menu, ItemTransportFlow.WITHDRAW, null)) {
|
||||
final ItemStack is = menu.getItemInSlot(slot);
|
||||
if (SlimefunManager.isItemSimiliar(is, template, true, DataType.ALWAYS) && matchesFilter(node, is, -1)) {
|
||||
if (SlimefunManager.isItemSimiliar(is, template, true) && matchesFilter(node, is, -1)) {
|
||||
if (is.getAmount() > template.getAmount()) {
|
||||
menu.replaceExistingItem(slot, new CustomItem(is, is.getAmount() - template.getAmount()));
|
||||
return template;
|
||||
@ -55,7 +55,7 @@ public class CargoManager {
|
||||
Inventory inv = ((InventoryHolder) target.getState()).getInventory();
|
||||
for (int slot = 0; slot < inv.getContents().length; slot++) {
|
||||
final ItemStack is = inv.getContents()[slot];
|
||||
if (SlimefunManager.isItemSimiliar(is, template, true, DataType.ALWAYS) && matchesFilter(node, is, -1)) {
|
||||
if (SlimefunManager.isItemSimiliar(is, template, true) && matchesFilter(node, is, -1)) {
|
||||
if (is.getAmount() > template.getAmount()) {
|
||||
inv.setItem(slot, ChestManipulator.trigger(target, slot, is, new CustomItem(is, is.getAmount() - template.getAmount())));
|
||||
return template;
|
||||
@ -114,7 +114,7 @@ public class CargoManager {
|
||||
menu.replaceExistingItem(slot, stack.clone());
|
||||
return null;
|
||||
}
|
||||
else if (SlimefunManager.isItemSimiliar(new CustomItem(is, 1), new CustomItem(stack, 1), true, DataType.ALWAYS) && is.getAmount() < is.getType().getMaxStackSize()) {
|
||||
else if (SlimefunManager.isItemSimiliar(new CustomItem(is, 1), new CustomItem(stack, 1), true) && is.getAmount() < is.getType().getMaxStackSize()) {
|
||||
int amount = is.getAmount() + stack.getAmount();
|
||||
|
||||
if (amount > is.getType().getMaxStackSize()) {
|
||||
@ -139,7 +139,7 @@ public class CargoManager {
|
||||
menu.replaceExistingItem(slot, stack.clone());
|
||||
return null;
|
||||
}
|
||||
else if (SlimefunManager.isItemSimiliar(new CustomItem(is, 1), new CustomItem(stack, 1), true, DataType.ALWAYS) && is.getAmount() < is.getType().getMaxStackSize()) {
|
||||
else if (SlimefunManager.isItemSimiliar(new CustomItem(is, 1), new CustomItem(stack, 1), true) && is.getAmount() < is.getType().getMaxStackSize()) {
|
||||
int amount = is.getAmount() + stack.getAmount();
|
||||
|
||||
if (amount > is.getType().getMaxStackSize()) {
|
||||
@ -165,7 +165,7 @@ public class CargoManager {
|
||||
inv.setItem(slot, ChestManipulator.trigger(target, slot, null, stack.clone()));
|
||||
return null;
|
||||
}
|
||||
else if (SlimefunManager.isItemSimiliar(new CustomItem(is, 1), new CustomItem(stack, 1), true, DataType.ALWAYS) && is.getAmount() < is.getType().getMaxStackSize()) {
|
||||
else if (SlimefunManager.isItemSimiliar(new CustomItem(is, 1), new CustomItem(stack, 1), true) && is.getAmount() < is.getType().getMaxStackSize()) {
|
||||
ItemStack prev = is.clone();
|
||||
int amount = is.getAmount() + stack.getAmount();
|
||||
|
||||
|
@ -26,7 +26,6 @@ import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Math.DoubleHandler;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunStartup;
|
||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager.DataType;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||
import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu;
|
||||
@ -38,8 +37,8 @@ public class CargoNet extends Network {
|
||||
|
||||
private static final int RANGE = 5;
|
||||
public static List<BlockFace> faces = Arrays.asList(BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST);
|
||||
public static Map<Location, Integer> round_robin = new HashMap<Location, Integer>();
|
||||
public static Set<ItemRequest> requests = new HashSet<ItemRequest>();
|
||||
public static Map<Location, Integer> round_robin = new HashMap<>();
|
||||
public static Set<ItemRequest> requests = new HashSet<>();
|
||||
|
||||
private static int[] slots = new int[] {19, 20, 21, 28, 29, 30, 37, 38, 39};
|
||||
|
||||
@ -278,7 +277,7 @@ public class CargoNet extends Network {
|
||||
case WITHDRAW: {
|
||||
int slot = request.getSlot();
|
||||
ItemStack prevStack = menu.getItemInSlot(slot);
|
||||
if (!(prevStack == null || (prevStack.getAmount() + request.getItem().getAmount() <= prevStack.getMaxStackSize() && SlimefunManager.isItemSimiliar(prevStack, new CustomItem(request.getItem(), 1), true, DataType.ALWAYS)))) {
|
||||
if (!(prevStack == null || (prevStack.getAmount() + request.getItem().getAmount() <= prevStack.getMaxStackSize() && SlimefunManager.isItemSimiliar(prevStack, new CustomItem(request.getItem(), 1), true)))) {
|
||||
iterator.remove();
|
||||
break;
|
||||
}
|
||||
@ -403,7 +402,7 @@ public class CargoNet extends Network {
|
||||
if (is != null && CargoManager.matchesFilter(l.getBlock(), is, -1)) {
|
||||
boolean add = true;
|
||||
for (StoredItem item: items) {
|
||||
if (SlimefunManager.isItemSimiliar(is, item.getItem(), true, DataType.ALWAYS)) {
|
||||
if (SlimefunManager.isItemSimiliar(is, item.getItem(), true)) {
|
||||
add = false;
|
||||
item.add(is.getAmount());
|
||||
}
|
||||
@ -424,7 +423,7 @@ public class CargoNet extends Network {
|
||||
if (is != null && CargoManager.matchesFilter(l.getBlock(), is, -1)) {
|
||||
boolean add = true;
|
||||
for (StoredItem item: items) {
|
||||
if (SlimefunManager.isItemSimiliar(is, item.getItem(), true, DataType.ALWAYS)) {
|
||||
if (SlimefunManager.isItemSimiliar(is, item.getItem(), true)) {
|
||||
add = false;
|
||||
item.add(is.getAmount() + stored);
|
||||
}
|
||||
@ -442,7 +441,7 @@ public class CargoNet extends Network {
|
||||
if (is != null && CargoManager.matchesFilter(l.getBlock(), is, -1)) {
|
||||
boolean add = true;
|
||||
for (StoredItem item: items) {
|
||||
if (SlimefunManager.isItemSimiliar(is, item.getItem(), true, DataType.ALWAYS)) {
|
||||
if (SlimefunManager.isItemSimiliar(is, item.getItem(), true)) {
|
||||
add = false;
|
||||
item.add(is.getAmount());
|
||||
}
|
||||
@ -461,7 +460,7 @@ public class CargoNet extends Network {
|
||||
if (is != null && CargoManager.matchesFilter(l.getBlock(), is, -1)) {
|
||||
boolean add = true;
|
||||
for (StoredItem item: items) {
|
||||
if (SlimefunManager.isItemSimiliar(is, item.getItem(), true, DataType.ALWAYS)) {
|
||||
if (SlimefunManager.isItemSimiliar(is, item.getItem(), true)) {
|
||||
add = false;
|
||||
item.add(is.getAmount());
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ChestManipulator {
|
||||
|
||||
public static List<CargoTransportEvent> listeners = new ArrayList<CargoTransportEvent>();
|
||||
public static List<CargoTransportEvent> listeners = new ArrayList<>();
|
||||
|
||||
public static void registerListener(CargoTransportEvent listener) {
|
||||
listeners.add(listener);
|
||||
|
@ -1,32 +0,0 @@
|
||||
package me.mrCookieSlime.Slimefun.api.machine;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
|
||||
|
||||
public class MachineConfig extends Config {
|
||||
|
||||
MachineSettings global;
|
||||
Map<String, MachineSettings> children;
|
||||
|
||||
public MachineConfig(String id) {
|
||||
super("plugins/Slimefun/machines/" + id + ".yml");
|
||||
|
||||
this.global = new MachineSettings(this);
|
||||
this.children = new HashMap<String, MachineSettings>();
|
||||
}
|
||||
|
||||
public MachineSettings getGlobalSettings() {
|
||||
return this.global;
|
||||
}
|
||||
|
||||
public MachineSettings getSettings(AContainer item) {
|
||||
if (!this.children.containsKey(item.getID())) {
|
||||
this.children.put(item.getID(), new MachineSettings(this, item));
|
||||
}
|
||||
|
||||
return this.children.get(item.getID());
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package me.mrCookieSlime.Slimefun.api.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
|
||||
|
||||
public class MachineSettings {
|
||||
|
||||
MachineConfig cfg;
|
||||
String prefix = "global";
|
||||
|
||||
public MachineSettings(MachineConfig cfg) {
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
public MachineSettings(MachineConfig cfg, AContainer machine) {
|
||||
this.cfg = cfg;
|
||||
this.prefix = machine.getID();
|
||||
}
|
||||
|
||||
public String getString(String path) {
|
||||
return this.cfg.getString(prefix + "." + path);
|
||||
}
|
||||
|
||||
public int getInt(String path) {
|
||||
return this.cfg.getInt(prefix + "." + path);
|
||||
}
|
||||
|
||||
public List<String> getStringList(String path) {
|
||||
return this.cfg.getStringList(prefix + "." + path);
|
||||
}
|
||||
|
||||
}
|
@ -13,7 +13,9 @@ import me.mrCookieSlime.CSCoreLibPlugin.general.Particles.MC_1_13.ParticleEffect
|
||||
import me.mrCookieSlime.Slimefun.SlimefunStartup;
|
||||
|
||||
public abstract class Network {
|
||||
private static List<Network> NETWORK_LIST = new ArrayList<Network>();
|
||||
|
||||
private static List<Network> NETWORK_LIST = new ArrayList<>();
|
||||
|
||||
public static<T extends Network> T getNetworkFromLocation(Location l, Class<T> type) {
|
||||
for(Network n: NETWORK_LIST) {
|
||||
if(type.isInstance(n) && n.connectsTo(l)) {
|
||||
@ -24,7 +26,7 @@ public abstract class Network {
|
||||
}
|
||||
|
||||
public static<T extends Network> List<T> getNetworksFromLocation(Location l, Class<T> type) {
|
||||
List<T> ret = new ArrayList<T>();
|
||||
List<T> ret = new ArrayList<>();
|
||||
for(Network n: NETWORK_LIST) {
|
||||
if(type.isInstance(n) && n.connectsTo(l)) {
|
||||
ret.add(type.cast(n));
|
||||
@ -59,12 +61,12 @@ public abstract class Network {
|
||||
public abstract void locationClassificationChange(Location l, Component from, Component to);
|
||||
|
||||
protected Location regulator;
|
||||
private Queue<Location> nodeQueue = new ArrayDeque<Location>();
|
||||
private Queue<Location> nodeQueue = new ArrayDeque<>();
|
||||
|
||||
protected Set<Location> connectedLocations = new HashSet<Location>();
|
||||
protected Set<Location> regulatorNodes = new HashSet<Location>();
|
||||
protected Set<Location> connectorNodes = new HashSet<Location>();
|
||||
protected Set<Location> terminusNodes = new HashSet<Location>();
|
||||
protected Set<Location> connectedLocations = new HashSet<>();
|
||||
protected Set<Location> regulatorNodes = new HashSet<>();
|
||||
protected Set<Location> connectorNodes = new HashSet<>();
|
||||
protected Set<Location> terminusNodes = new HashSet<>();
|
||||
|
||||
protected Network(Location regulator) {
|
||||
this.regulator = regulator;
|
||||
|
@ -43,9 +43,9 @@ public class BowListener implements Listener {
|
||||
|
||||
private void handleGrapplingHook(Arrow arrow) {
|
||||
if (arrow != null) {
|
||||
if (arrow.getShooter() instanceof Player && Variables.jump.containsKey(((Player) arrow.getShooter()).getUniqueId())) {
|
||||
if (arrow.getShooter() instanceof Player && Variables.jump_state.containsKey(((Player) arrow.getShooter()).getUniqueId())) {
|
||||
final Player p = (Player) arrow.getShooter();
|
||||
if (p.getGameMode() != GameMode.CREATIVE && Variables.jump.get(p.getUniqueId())) arrow.getWorld().dropItem(arrow.getLocation(), SlimefunItem.getItem("GRAPPLING_HOOK"));
|
||||
if (p.getGameMode() != GameMode.CREATIVE && Variables.jump_state.get(p.getUniqueId())) arrow.getWorld().dropItem(arrow.getLocation(), SlimefunItem.getItem("GRAPPLING_HOOK"));
|
||||
if (p.getLocation().distance(arrow.getLocation()) < 3.0D) {
|
||||
if (arrow.getLocation().getY() > p.getLocation().getY()) {
|
||||
p.setVelocity(new Vector(0.0D, 0.25D, 0.0D));
|
||||
@ -56,7 +56,7 @@ public class BowListener implements Listener {
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, () -> {
|
||||
Variables.jump.remove(p.getUniqueId());
|
||||
Variables.jump_state.remove(p.getUniqueId());
|
||||
Variables.remove.remove(p.getUniqueId());
|
||||
}, 20L);
|
||||
}
|
||||
@ -85,7 +85,7 @@ public class BowListener implements Listener {
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, () -> {
|
||||
Variables.jump.remove(p.getUniqueId());
|
||||
Variables.jump_state.remove(p.getUniqueId());
|
||||
Variables.remove.remove(p.getUniqueId());
|
||||
}, 20L);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class DamageListener implements Listener {
|
||||
@EventHandler
|
||||
public void onArrowHit(EntityDamageEvent e) {
|
||||
if (e.getEntity() instanceof Player && e.getCause() == DamageCause.FALL) {
|
||||
if (Variables.damage.containsKey(e.getEntity().getUniqueId())) {
|
||||
if (Variables.damage.contains(e.getEntity().getUniqueId())) {
|
||||
e.setCancelled(true);
|
||||
Variables.damage.remove(e.getEntity().getUniqueId());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user