1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Replaced deprecated methods

This commit is contained in:
SoSeDiK 2018-06-06 12:41:56 +03:00
parent 6eb17d1d45
commit 3cf306ce34
26 changed files with 233 additions and 232 deletions

View File

@ -131,7 +131,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
@Override
public boolean canOpen(Block b, Player p) {
boolean open = BlockStorage.getBlockInfo(b, "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.android.bypass");
boolean open = BlockStorage.getLocationInfo(b.getLocation(), "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.android.bypass");
if (!open) {
Messages.local.sendTranslation(p, "inventory.no-access", true);
}
@ -208,7 +208,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
@Override
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
boolean allow = reason.equals(UnregisterReason.PLAYER_BREAK) && (BlockStorage.getBlockInfo(b, "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.android.bypass"));
boolean allow = reason.equals(UnregisterReason.PLAYER_BREAK) && (BlockStorage.getLocationInfo(b.getLocation(), "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.android.bypass"));
if (allow) {
BlockMenu inv = BlockStorage.getInventory(b);
@ -238,12 +238,12 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
if (!(b.getState() instanceof Skull)) {
return;
}
} catch(NullPointerException x) {
} catch (NullPointerException x) {
return;
}
if (BlockStorage.getBlockInfo(b, "paused").equals("false")) {
float fuel = Float.parseFloat(BlockStorage.getBlockInfo(b, "fuel"));
if (BlockStorage.getLocationInfo(b.getLocation(), "paused").equals("false")) {
float fuel = Float.parseFloat(BlockStorage.getLocationInfo(b.getLocation(), "fuel"));
if (fuel == 0) {
ItemStack item = BlockStorage.getInventory(b).getItemInSlot(43);
if (item != null) {
@ -260,8 +260,8 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
}
}
else {
String[] script = BlockStorage.getBlockInfo(b, "script").split("-");
int index = Integer.parseInt(BlockStorage.getBlockInfo(b, "index")) + 1;
String[] script = BlockStorage.getLocationInfo(b.getLocation(), "script").split("-");
int index = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "index")) + 1;
if (index >= script.length) index = 0;
boolean refresh = true;
BlockStorage.addBlockInfo(b, "fuel", String.valueOf(fuel - 1));
@ -271,7 +271,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
switch(part) {
case GO_DOWN: {
try {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(BlockFace.DOWN);
move(b, face, block);
} catch (Exception e) {
@ -281,7 +281,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
}
case GO_FORWARD: {
try {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(face);
move(b, face, block);
} catch (Exception e) {
@ -291,7 +291,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
}
case GO_UP: {
try {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(BlockFace.UP);
move(b, face, block);
} catch (Exception e) {
@ -304,7 +304,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
break;
}
case TURN_LEFT: {
int rotIndex = directions.indexOf(BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"))) - 1;
int rotIndex = directions.indexOf(BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) - 1;
if (rotIndex < 0) rotIndex = directions.size() - 1;
BlockFace dir = directions.get(rotIndex);
Skull skull = (Skull) b.getState();
@ -314,7 +314,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
break;
}
case TURN_RIGHT: {
int rotIndex = directions.indexOf(BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"))) + 1;
int rotIndex = directions.indexOf(BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) + 1;
if (rotIndex == directions.size()) rotIndex = 0;
BlockFace dir = directions.get(rotIndex);
Skull skull = (Skull) b.getState();
@ -324,7 +324,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
break;
}
case DIG_FORWARD: {
Block block = b.getRelative(BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation")));
Block block = b.getRelative(BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation")));
mine(b, block);
break;
}
@ -351,25 +351,25 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
break;
}
case MOVE_AND_DIG_FORWARD: {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(face);
movedig(b, face, block);
break;
}
case MOVE_AND_DIG_UP: {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(BlockFace.UP);
movedig(b, face, block);
break;
}
case MOVE_AND_DIG_DOWN: {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(BlockFace.DOWN);
movedig(b, face, block);
break;
}
case INTERFACE_ITEMS: {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(face);
if (BlockStorage.check(block, "ANDROID_INTERFACE_ITEMS") && block.getState() instanceof Dispenser) {
Dispenser d = (Dispenser) block.getState();
@ -390,7 +390,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
break;
}
case INTERFACE_FUEL: {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(face);
if (BlockStorage.check(block, "ANDROID_INTERFACE_FUEL") && block.getState() instanceof Dispenser) {
Dispenser d = (Dispenser) block.getState();
@ -417,7 +417,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
break;
}
case FARM_FORWARD: {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(face);
farm(b, block);
break;
@ -428,7 +428,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
break;
}
case FARM_EXOTIC_FORWARD: {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(face);
exoticFarm(b, block);
break;
@ -439,7 +439,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
break;
}
case CHOP_TREE: {
BlockFace face = BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"));
BlockFace face = BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"));
Block block = b.getRelative(face);
if (block.getType().equals(Material.LOG) || block.getType().equals(Material.LOG_2)) {
List<Location> list = new ArrayList<Location>();
@ -450,7 +450,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
Block log = list.get(list.size() - 1).getBlock();
Collection<ItemStack> drops = log.getDrops();
log.getWorld().playEffect(log.getLocation(), Effect.STEP_SOUND, log.getType());
if (!drops.isEmpty() && CSCoreLib.getLib().getProtectionManager().canBuild(UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), log)) {
if (!drops.isEmpty() && CSCoreLib.getLib().getProtectionManager().canBuild(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), log)) {
ItemStack[] items = drops.toArray(new ItemStack[drops.size()]);
if (fits(b, items)) {
pushItems(b, items);
@ -474,7 +474,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
entities:
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
switch (BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"))) {
switch (BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) {
case NORTH: {
if (n instanceof LivingEntity && !(n instanceof ArmorStand) && !(n instanceof Player) && n.getLocation().getZ() < b.getZ()) {
if (n.hasMetadata("android_killer")) n.removeMetadata("android_killer", SlimefunStartup.instance);
@ -527,7 +527,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
entities:
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
if (n instanceof Animals) continue;
switch (BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"))) {
switch (BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) {
case NORTH: {
if (n instanceof LivingEntity && !(n instanceof ArmorStand) && !(n instanceof Player) && n.getLocation().getZ() < b.getZ()) {
if (n.hasMetadata("android_killer")) n.removeMetadata("android_killer", SlimefunStartup.instance);
@ -581,7 +581,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
entities:
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
if (n instanceof Monster) continue;
switch (BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"))) {
switch (BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) {
case NORTH: {
if (n instanceof LivingEntity && !(n instanceof ArmorStand) && !(n instanceof Player) && n.getLocation().getZ() < b.getZ()) {
if (n.hasMetadata("android_killer")) n.removeMetadata("android_killer", SlimefunStartup.instance);
@ -636,7 +636,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
for (Entity n: AndroidStatusHologram.getNearbyEntities(b, 4D + getTier())) {
if (n instanceof Monster) continue;
if (n instanceof Ageable && !((Ageable) n).isAdult()) continue;
switch (BlockFace.valueOf(BlockStorage.getBlockInfo(b, "rotation"))) {
switch (BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) {
case NORTH: {
if (n instanceof LivingEntity && !(n instanceof ArmorStand) && !(n instanceof Player) && n.getLocation().getZ() < b.getZ()) {
if (n.hasMetadata("android_killer")) n.removeMetadata("android_killer", SlimefunStartup.instance);
@ -705,26 +705,27 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
skull.update(true, false);
CustomSkull.setSkull(block, CustomSkull.getTexture(getItem()));
b.setType(Material.AIR);
BlockStorage.moveBlockInfo(b, block);
BlockStorage.moveBlockInfo(b.getLocation(), block.getLocation());
}
}
private void mine(Block b, Block block) {
Collection<ItemStack> drops = block.getDrops();
if (!blockblacklist.contains(block.getType()) && !drops.isEmpty() && CSCoreLib.getLib().getProtectionManager().canBuild(UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), block)) {
if (!blockblacklist.contains(block.getType()) && !drops.isEmpty() && CSCoreLib.getLib().getProtectionManager().canBuild(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), block)) {
SlimefunItem item = BlockStorage.check(block);
if(item != null) {
if(fits(b, item.getItem())) {
if(SlimefunItem.blockhandler.containsKey(item.getID())) {
if (item != null) {
if (fits(b, item.getItem())) {
if (SlimefunItem.blockhandler.containsKey(item.getID())) {
if (SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG)) {
pushItems(b, BlockStorage.retrieve(block));
if(SlimefunItem.blockhandler.containsKey(item.getID())) SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG);
if (SlimefunItem.blockhandler.containsKey(item.getID())) SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG);
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
block.setType(Material.AIR);
}
}
}
}else {
}
else {
ItemStack[] items = drops.toArray(new ItemStack[drops.size()]);
if (fits(b, items)) {
pushItems(b, items);
@ -738,12 +739,12 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
@SuppressWarnings("deprecation")
private void movedig(Block b, BlockFace face, Block block) {
Collection<ItemStack> drops = block.getDrops();
if (!blockblacklist.contains(block.getType()) && !drops.isEmpty() && CSCoreLib.getLib().getProtectionManager().canBuild(UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), block)) {
if (!blockblacklist.contains(block.getType()) && !drops.isEmpty() && CSCoreLib.getLib().getProtectionManager().canBuild(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), block)) {
try {
SlimefunItem item = BlockStorage.check(block);
if(item != null) {
if(fits(b, item.getItem())) {
if(SlimefunItem.blockhandler.containsKey(item.getID())) {
if (item != null) {
if (fits(b, item.getItem())) {
if (SlimefunItem.blockhandler.containsKey(item.getID())) {
if (SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG)) {
pushItems(b, BlockStorage.retrieve(block));
@ -757,7 +758,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
skull.update(true, false);
CustomSkull.setSkull(block, CustomSkull.getTexture(getItem()));
b.setType(Material.AIR);
BlockStorage.moveBlockInfo(b, block);
BlockStorage.moveBlockInfo(b.getLocation(), block.getLocation());
}
}
}
@ -775,10 +776,10 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
skull.update(true, false);
CustomSkull.setSkull(block, CustomSkull.getTexture(getItem()));
b.setType(Material.AIR);
BlockStorage.moveBlockInfo(b, block);
BlockStorage.moveBlockInfo(b.getLocation(), block.getLocation());
}
}
} catch(Exception x) {
} catch (Exception x) {
x.printStackTrace();
}
}
@ -957,7 +958,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
@Override
public boolean onClick(Player p, int slot, ItemStack stack, ClickAction action) {
try {
openScript(p, b, BlockStorage.getBlockInfo(b, "script"));
openScript(p, b, BlockStorage.getLocationInfo(b.getLocation(), "script"));
} catch (Exception e) {
e.printStackTrace();
}
@ -1152,7 +1153,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
final String code = BlockStorage.getBlockInfo(b, "script");
final String code = BlockStorage.getLocationInfo(b.getLocation(), "script");
int num = 1;
for (Config script: getUploadedScripts()) {
@ -1564,4 +1565,5 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
return list;
}
}
}

View File

@ -107,14 +107,14 @@ public class SlimefunCommand implements CommandExecutor, Listener {
}
else if (args[0].equalsIgnoreCase("guide")) {
if (sender instanceof Player) {
if(sender.hasPermission("slimefun.command.guide"))((Player) sender).getInventory().addItem(SlimefunGuide.getItem(SlimefunStartup.getCfg().getBoolean("guide.default-view-book")));
if (sender.hasPermission("slimefun.command.guide"))((Player) sender).getInventory().addItem(SlimefunGuide.getItem(SlimefunStartup.getCfg().getBoolean("guide.default-view-book")));
else Messages.local.sendTranslation(sender, "messages.no-permission", true);
}
else Messages.local.sendTranslation(sender, "messages.only-players", true);
}
else if(args[0].equalsIgnoreCase("open_guide")) {
else if (args[0].equalsIgnoreCase("open_guide")) {
if (sender instanceof Player) {
if(sender.hasPermission("slimefun.command.open_guide")) SlimefunGuide.openGuide((Player) sender, SlimefunStartup.getCfg().getBoolean("guide.default-view-book"));
if (sender.hasPermission("slimefun.command.open_guide")) SlimefunGuide.openGuide((Player) sender, SlimefunStartup.getCfg().getBoolean("guide.default-view-book"));
else Messages.local.sendTranslation(sender, "messages.no-permission", true);
}
else Messages.local.sendTranslation(sender, "messages.only-players", true);
@ -142,18 +142,18 @@ public class SlimefunCommand implements CommandExecutor, Listener {
double y = Integer.parseInt(args[2]) + 0.4D;
double z = Integer.parseInt(args[3]) + 0.5D;
if (BlockStorage.getBlockInfo(((Player) sender).getWorld().getBlockAt(Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])), "floor") != null) {
if (BlockStorage.getLocationInfo(((Player) sender).getWorld().getBlockAt(Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])).getLocation(), "floor") != null) {
Elevator.ignored.add(((Player) sender).getUniqueId());
float yaw = ((Player) sender).getEyeLocation().getYaw() + 180;
if (yaw > 180) yaw = -180 + (yaw - 180);
((Player) sender).teleport(new Location(((Player) sender).getWorld(), x, y, z, yaw, ((Player) sender).getEyeLocation().getPitch()));
try {
TitleBuilder title = (TitleBuilder) new TitleBuilder(20, 60, 20).addText("&r" + ChatColor.translateAlternateColorCodes('&', BlockStorage.getBlockInfo(((Player) sender).getWorld().getBlockAt(Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])), "floor")));
TitleBuilder title = (TitleBuilder) new TitleBuilder(20, 60, 20).addText("&r" + ChatColor.translateAlternateColorCodes('&', BlockStorage.getLocationInfo(((Player) sender).getWorld().getBlockAt(Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])).getLocation(), "floor")));
TitleBuilder subtitle = (TitleBuilder) new TitleBuilder(20, 60, 20).addText(" ");
title.send(TitleType.TITLE, ((Player) sender));
subtitle.send(TitleType.SUBTITLE, ((Player) sender));
} catch(Exception x1) {
} catch (Exception x1) {
x1.printStackTrace();
}
}

View File

@ -30,7 +30,7 @@ public class Elevator {
public static void openEditor(Player p, final Block b) {
ChestMenu menu = new ChestMenu("Elevator Settings");
menu.addItem(4, new CustomItem(new MaterialData(Material.NAME_TAG), "&7Floor Name &e(Click to edit)", "", "&r" + ChatColor.translateAlternateColorCodes('&', BlockStorage.getBlockInfo(b, "floor"))));
menu.addItem(4, new CustomItem(new MaterialData(Material.NAME_TAG), "&7Floor Name &e(Click to edit)", "", "&r" + ChatColor.translateAlternateColorCodes('&', BlockStorage.getLocationInfo(b.getLocation(), "floor"))));
menu.addMenuClickHandler(4, new MenuClickHandler() {
@Override
@ -75,7 +75,7 @@ public class Elevator {
for (int y = b.getWorld().getMaxHeight(); y > 0; y--) {
Block block = b.getWorld().getBlockAt(b.getX(), y, b.getZ());
if (BlockStorage.check(block, "ELEVATOR_PLATE")) {
String floor = ChatColor.translateAlternateColorCodes('&', BlockStorage.getBlockInfo(block, "floor"));
String floor = ChatColor.translateAlternateColorCodes('&', BlockStorage.getLocationInfo(block.getLocation(), "floor"));
if (block.getY() == b.getY()) {
tellraw.addText("&7> " + index + ". &r" + floor + "\n");
tellraw.addHoverEvent(HoverAction.SHOW_TEXT, "\n&eThis is the Floor you are currently on:\n&r" + floor + "\n");

View File

@ -38,7 +38,7 @@ public class ItemHash {
StringBuilder builder = new StringBuilder(LENGTH * 2);
for (char c: item.getHash().toCharArray()) {
builder.append('§');
builder.append('§');
builder.append(c);
}
@ -47,7 +47,7 @@ public class ItemHash {
public static SlimefunItem fromString(String input) {
if (input == null || input.length() != LENGTH * 2) return null;
String hex = input.replaceAll("§", "");
String hex = input.replaceAll("§", "");
if (hex.length() != LENGTH || !map.containsKey(hex)) return null;

View File

@ -288,7 +288,7 @@ public class SlimefunItems {
/* Alloy (Iron + Silicon) */
public static ItemStack FERROSILICON = new CustomItem(Material.IRON_INGOT, "&bFerrosilicon" , 0);
/* Alloy (Iron + Gold) */
public static ItemStack GILDED_IRON = new CustomItem(Material.GOLD_INGOT, "&6&lGilded Iron", 0);
public static ItemStack GILDED_IRON = new CustomItem(Material.GOLD_INGOT, "&6&lGilded Iron", 0);
/* Alloy (Redston + Ferrosilicon) */
public static ItemStack REDSTONE_ALLOY = new CustomItem(Material.CLAY_BRICK, "&cRedstone Alloy Ingot", 0);
/* Alloy (Iron + Copper) */

View File

@ -48,16 +48,16 @@ public abstract class AReactor extends SlimefunItem {
public static Map<Location, Integer> progress = new HashMap<Location, Integer>();
private static final BlockFace[] cooling =
{
BlockFace.NORTH,
BlockFace.NORTH_EAST,
BlockFace.EAST,
BlockFace.SOUTH_EAST,
BlockFace.SOUTH,
BlockFace.SOUTH_WEST,
BlockFace.WEST,
BlockFace.NORTH_WEST
};
{
BlockFace.NORTH,
BlockFace.NORTH_EAST,
BlockFace.EAST,
BlockFace.SOUTH_EAST,
BlockFace.SOUTH,
BlockFace.SOUTH_WEST,
BlockFace.WEST,
BlockFace.NORTH_WEST
};
private Set<MachineFuel> recipes = new HashSet<MachineFuel>();
@ -65,7 +65,7 @@ public abstract class AReactor extends SlimefunItem {
private static final int[] border_1 = {9, 10, 11, 18, 20, 27, 29, 36, 38, 45, 46, 47};
private static final int[] border_2 = {15, 16, 17, 24, 26, 33, 35, 42, 44, 51, 52, 53};
private static final int[] border_3 = {30, 31, 32, 39, 41, 48, 49, 50};
private static final int[] border_4 = {25, 34, 43}; //No coolant border
private static final int[] border_4 = {25, 34, 43}; // No coolant border
public AReactor(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, id, recipeType, recipe);
@ -80,10 +80,10 @@ public abstract class AReactor extends SlimefunItem {
@Override
public void newInstance(final BlockMenu menu, final Block b) {
try {
if (BlockStorage.getBlockInfo(b, "reactor-mode") == null){
if (BlockStorage.getLocationInfo(b.getLocation(), "reactor-mode") == null){
BlockStorage.addBlockInfo(b, "reactor-mode", "generator");
}
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "reactor-mode").equals("generator")) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "reactor-mode").equals("generator")) {
menu.replaceExistingItem(4, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTM0M2NlNThkYTU0Yzc5OTI0YTJjOTMzMWNmYzQxN2ZlOGNjYmJlYTliZTQ1YTdhYzg1ODYwYTZjNzMwIn19fQ=="), "&7Focus: &eElectricity", "", "&6Your Reactor will focus on Power Generation", "&6If your Energy Network doesn't need Power", "&6it will not produce any either", "", "&7> Click to change the Focus to &eProduction"));
menu.addMenuClickHandler(4, new MenuClickHandler() {
@ -220,7 +220,7 @@ public abstract class AReactor extends SlimefunItem {
});
for (int i : border_2) {
for (int i : border_2) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 9), " "),
new MenuClickHandler() {
@ -236,19 +236,19 @@ public abstract class AReactor extends SlimefunItem {
preset.addItem(7, new CustomItem(this.getCoolant(), "&bCoolant Slot", "", "&rThis Slot accepts Coolant Cells", "&4Without any Coolant Cells, your Reactor", "&4will explode"));
}
else {
preset.addItem(7, new CustomItem(new MaterialData(Material.BARRIER), "&bCoolant Slot", "", "&rThis Slot accepts Coolant Cells"));
preset.addItem(7, new CustomItem(new MaterialData(Material.BARRIER), "&bCoolant Slot", "", "&rThis Slot accepts Coolant Cells"));
for (int i : border_4) {
preset.addItem(i, new CustomItem(new ItemStack(Material.BARRIER), "&cNo Coolant Required"),
new MenuClickHandler() {
for (int i : border_4) {
preset.addItem(i, new CustomItem(new ItemStack(Material.BARRIER), "&cNo Coolant Required"),
new MenuClickHandler() {
@Override
public boolean onClick(Player player, int i, ItemStack itemStack, ClickAction clickAction) {
return false;
}
});
}
}
@Override
public boolean onClick(Player player, int i, ItemStack itemStack, ClickAction clickAction) {
return false;
}
});
}
}
}
public abstract String getInventoryTitle();
@ -326,18 +326,18 @@ public abstract class AReactor extends SlimefunItem {
});
ItemStack item = getProgressBar().clone();
ItemMeta im = item.getItemMeta();
im.setDisplayName(" ");
List<String> lore = new ArrayList<String>();
lore.add(MachineHelper.getProgress(timeleft, processing.get(l).getTicks()));
lore.add(MachineHelper.getCoolant(timeleft, processing.get(l).getTicks()));
lore.add("");
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
im.setLore(lore);
item.setItemMeta(im);
ItemStack item = getProgressBar().clone();
ItemMeta im = item.getItemMeta();
im.setDisplayName(" ");
List<String> lore = new ArrayList<String>();
lore.add(MachineHelper.getProgress(timeleft, processing.get(l).getTicks()));
lore.add(MachineHelper.getCoolant(timeleft, processing.get(l).getTicks()));
lore.add("");
lore.add(MachineHelper.getTimeLeft(timeleft / 2));
im.setLore(lore);
item.setItemMeta(im);
BlockStorage.getInventory(l).replaceExistingItem(22, item);
BlockStorage.getInventory(l).replaceExistingItem(22, item);
if (needsCooling()) {
boolean coolant = (processing.get(l).getTicks() - timeleft) % 25 == 0;

View File

@ -42,7 +42,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
@Override
public void newInstance(final BlockMenu menu, final Block b) {
try {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-type") == null || BlockStorage.getBlockInfo(b, "filter-type").equals("whitelist")) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "filter-type") == null || BlockStorage.getLocationInfo(b.getLocation(), "filter-type").equals("whitelist")) {
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL), "&7Type: &rWhitelist", "", "&e> Click to change it to Blacklist"));
menu.addMenuClickHandler(15, new MenuClickHandler() {
@ -67,7 +67,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
});
}
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-durability") == null || BlockStorage.getBlockInfo(b, "filter-durability").equals("false")) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "filter-durability") == null || BlockStorage.getLocationInfo(b.getLocation(), "filter-durability").equals("false")) {
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.STONE_SWORD, (byte) 20), "&7Include Sub-IDs/Durability: &4\u2718", "", "&e> Click to toggle whether the Durability has to match"));
menu.addMenuClickHandler(16, new MenuClickHandler() {
@ -92,7 +92,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
});
}
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-lore") == null || BlockStorage.getBlockInfo(b, "filter-lore").equals("true")) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "filter-lore") == null || BlockStorage.getLocationInfo(b.getLocation(), "filter-lore").equals("true")) {
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "&7Include Lore: &2\u2714", "", "&e> Click to toggle whether the Lore has to match"));
menu.addMenuClickHandler(25, new MenuClickHandler() {
@ -122,7 +122,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
int channel = Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")) - 1;
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) - 1;
if (channel < 0) {
if (CargoNet.EXTRA_CHANNELS) channel = 16;
else channel = 15;
@ -133,7 +133,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
}
});
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))));
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency"))));
if (channel == 16) {
menu.replaceExistingItem(42, new CustomItem(SlimefunItems.CHEST_TERMINAL, "&bChannel ID: &3" + (channel + 1)));
@ -161,7 +161,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
int channel = Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")) + 1;
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) + 1;
if (CargoNet.EXTRA_CHANNELS) {
if (channel > 16) channel = 0;

View File

@ -58,7 +58,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
@Override
public void newInstance(final BlockMenu menu, final Block b) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "enabled") == null || BlockStorage.getBlockInfo(b, "enabled").equals("false")) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "enabled") == null || BlockStorage.getLocationInfo(b.getLocation(), "enabled").equals("false")) {
menu.replaceExistingItem(6, new CustomItem(new MaterialData(Material.SULPHUR), "&7Enabled: &4\u2718", "", "&e> Click to enable this Machine"));
menu.addMenuClickHandler(6, new MenuClickHandler() {
@ -256,7 +256,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
}
protected void tick(Block b) {
if (BlockStorage.getBlockInfo(b, "enabled").equals("false")) return;
if (BlockStorage.getLocationInfo(b.getLocation(), "enabled").equals("false")) return;
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
BlockMenu menu = BlockStorage.getInventory(b);

View File

@ -45,7 +45,7 @@ public class CargoCraftingNode extends SlimefunItem {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
int channel = Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")) - 1;
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) - 1;
if (channel < 0) channel = 15;
BlockStorage.addBlockInfo(b, "frequency", String.valueOf(channel));
newInstance(menu, b);
@ -53,7 +53,7 @@ public class CargoCraftingNode extends SlimefunItem {
}
});
menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))))), "&bChannel ID: &3" + (((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")))) + 1)));
menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency"))))), "&bChannel ID: &3" + (((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")))) + 1)));
menu.addMenuClickHandler(42, new MenuClickHandler() {
@Override
@ -67,7 +67,7 @@ public class CargoCraftingNode extends SlimefunItem {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
int channel = Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")) + 1;
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) + 1;
if (channel > 15) channel = 0;
BlockStorage.addBlockInfo(b, "frequency", String.valueOf(channel));
newInstance(menu, b);

View File

@ -42,7 +42,7 @@ public class CargoInputNode extends SlimefunItem {
@Override
public void newInstance(final BlockMenu menu, final Block b) {
try {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-type") == null || BlockStorage.getBlockInfo(b, "filter-type").equals("whitelist")) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "filter-type") == null || BlockStorage.getLocationInfo(b.getLocation(), "filter-type").equals("whitelist")) {
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL), "&7Type: &rWhitelist", "", "&e> Click to change it to Blacklist"));
menu.addMenuClickHandler(15, new MenuClickHandler() {
@ -67,7 +67,7 @@ public class CargoInputNode extends SlimefunItem {
});
}
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-durability") == null || BlockStorage.getBlockInfo(b, "filter-durability").equals("false")) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "filter-durability") == null || BlockStorage.getLocationInfo(b.getLocation(), "filter-durability").equals("false")) {
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.STONE_SWORD, (byte) 20), "&7Include Sub-IDs/Durability: &4\u2718", "", "&e> Click to toggle whether the Durability has to match"));
menu.addMenuClickHandler(16, new MenuClickHandler() {
@ -92,7 +92,7 @@ public class CargoInputNode extends SlimefunItem {
});
}
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "round-robin") == null || BlockStorage.getBlockInfo(b, "round-robin").equals("false")) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "round-robin") == null || BlockStorage.getLocationInfo(b.getLocation(), "round-robin").equals("false")) {
menu.replaceExistingItem(24, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDc4ZjJiN2U1ZTc1NjM5ZWE3ZmI3OTZjMzVkMzY0YzRkZjI4YjQyNDNlNjZiNzYyNzdhYWRjZDYyNjEzMzcifX19"), "&7Round-Robin Mode: &4\u2718", "", "&e> Click to enable Round Robin Mode", "&e(Items will be equally distributed on the Channel)"));
menu.addMenuClickHandler(24, new MenuClickHandler() {
@ -117,7 +117,7 @@ public class CargoInputNode extends SlimefunItem {
});
}
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "filter-lore") == null || BlockStorage.getBlockInfo(b, "filter-lore").equals("true")) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "filter-lore") == null || BlockStorage.getLocationInfo(b.getLocation(), "filter-lore").equals("true")) {
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "&7Include Lore: &2\u2714", "", "&e> Click to toggle whether the Lore has to match"));
menu.addMenuClickHandler(25, new MenuClickHandler() {
@ -147,7 +147,7 @@ public class CargoInputNode extends SlimefunItem {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
int channel = Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")) - 1;
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) - 1;
if (channel < 0) {
if (CargoNet.EXTRA_CHANNELS) channel = 16;
else channel = 15;
@ -158,7 +158,7 @@ public class CargoInputNode extends SlimefunItem {
}
});
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))));
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency"))));
if (channel == 16) {
menu.replaceExistingItem(42, new CustomItem(SlimefunItems.CHEST_TERMINAL, "&bChannel ID: &3" + (channel + 1)));
@ -186,7 +186,7 @@ public class CargoInputNode extends SlimefunItem {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
int channel = Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")) + 1;
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) + 1;
if (CargoNet.EXTRA_CHANNELS) {
if (channel > 16) channel = 0;

View File

@ -48,7 +48,7 @@ public class CargoOutputNode extends SlimefunItem {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
int channel = Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")) - 1;
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) - 1;
if (channel < 0) {
if (CargoNet.EXTRA_CHANNELS) channel = 16;
else channel = 15;
@ -59,7 +59,7 @@ public class CargoOutputNode extends SlimefunItem {
}
});
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency"))));
int channel = ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency"))));
if (channel == 16) {
menu.replaceExistingItem(13, new CustomItem(SlimefunItems.CHEST_TERMINAL, "&bChannel ID: &3" + (channel + 1)));
@ -87,7 +87,7 @@ public class CargoOutputNode extends SlimefunItem {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
int channel = Integer.parseInt(BlockStorage.getBlockInfo(b, "frequency")) + 1;
int channel = Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")) + 1;
if (CargoNet.EXTRA_CHANNELS) {
if (channel > 16) channel = 0;

View File

@ -52,7 +52,7 @@ public class WitherAssembler extends SlimefunItem {
@Override
public void newInstance(final BlockMenu menu, final Block b) {
try {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "enabled") == null || BlockStorage.getBlockInfo(b, "enabled").equals("false")) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "enabled") == null || BlockStorage.getLocationInfo(b.getLocation(), "enabled").equals("false")) {
menu.replaceExistingItem(22, new CustomItem(new MaterialData(Material.SULPHUR), "&7Enabled: &4\u2718", "", "&e> Click to enable this Machine"));
menu.addMenuClickHandler(22, new MenuClickHandler() {
@ -77,14 +77,14 @@ public class WitherAssembler extends SlimefunItem {
});
}
double offset = (!BlockStorage.hasBlockInfo(b) || BlockStorage.getBlockInfo(b, "offset") == null) ? 3.0F: Double.valueOf(BlockStorage.getBlockInfo(b, "offset"));
double offset = (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "offset") == null) ? 3.0F: Double.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "offset"));
menu.replaceExistingItem(31, new CustomItem(new MaterialData(Material.PISTON_BASE), "&7Offset: &3" + offset + " Block(s)", "", "&rLeft Click: &7+0.1", "&rRight Click: &7-0.1"));
menu.addMenuClickHandler(31, new MenuClickHandler() {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
double offset = DoubleHandler.fixDouble(Double.valueOf(BlockStorage.getBlockInfo(b, "offset")) + (arg3.isRightClicked() ? -0.1F: 0.1F));
double offset = DoubleHandler.fixDouble(Double.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "offset")) + (arg3.isRightClicked() ? -0.1F: 0.1F));
BlockStorage.addBlockInfo(b, "offset", String.valueOf(offset));
newInstance(menu, b);
return false;
@ -239,7 +239,7 @@ public class WitherAssembler extends SlimefunItem {
@SuppressWarnings("deprecation")
@Override
public void tick(final Block b, SlimefunItem sf, Config data) {
if (BlockStorage.getBlockInfo(b, "enabled").equals("false")) return;
if (BlockStorage.getLocationInfo(b.getLocation(), "enabled").equals("false")) return;
if (lifetime % 60 == 0) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
@ -297,7 +297,7 @@ public class WitherAssembler extends SlimefunItem {
ChargableBlock.addCharge(b, -getEnergyConsumption());
final double offset = Double.parseDouble(BlockStorage.getBlockInfo(b, "offset"));
final double offset = Double.parseDouble(BlockStorage.getLocationInfo(b.getLocation(), "offset"));
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {

View File

@ -186,7 +186,7 @@ public class XPCollector extends SlimefunItem {
}
private int getEXP(Block b) {
Config cfg = BlockStorage.getBlockInfo(b);
Config cfg = BlockStorage.getLocationInfo(b.getLocation());
if (cfg.contains("stored-exp")) return Integer.parseInt(cfg.getString("stored-exp"));
else {
BlockStorage.addBlockInfo(b, "stored-exp", "0");

View File

@ -198,7 +198,7 @@ public class SlimefunSetup {
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("ENHANCED_CRAFTING_TABLE");
if (mb.isMultiBlock(machine)) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
@ -346,7 +346,7 @@ public class SlimefunSetup {
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("GRIND_STONE");
if (mb.isMultiBlock(machine)) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
Inventory inv = disp.getInventory();
@ -387,7 +387,7 @@ public class SlimefunSetup {
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("ARMOR_FORGE");
if (mb.isMultiBlock(machine)) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
final Inventory inv = disp.getInventory();
@ -459,7 +459,7 @@ public class SlimefunSetup {
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("ORE_CRUSHER");
if (mb.isMultiBlock(machine)) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
Inventory inv = disp.getInventory();
@ -500,7 +500,7 @@ public class SlimefunSetup {
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("COMPRESSOR");
if (mb.isMultiBlock(machine)) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
final Inventory inv = disp.getInventory();
@ -613,8 +613,6 @@ public class SlimefunSetup {
@Override
public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.MAGIC_EYE_OF_ENDER, true)) {
//It don't works
//e.setCanceled(true);
e.getParentEvent().setCancelled(true);
PlayerInventory.update(p);
if (p.getInventory().getHelmet() != null && p.getInventory().getChestplate() != null && p.getInventory().getLeggings() != null && p.getInventory().getBoots() != null) {
@ -731,7 +729,7 @@ public class SlimefunSetup {
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("SMELTERY");
if (mb.isMultiBlock(machine)) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
Inventory inv = disp.getInventory();
@ -763,7 +761,7 @@ public class SlimefunSetup {
p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
Block raw_disp = b.getRelative(BlockFace.DOWN);
Hopper chamber = null;
if(BlockStorage.check(raw_disp.getRelative(BlockFace.EAST).getState().getBlock(), "IGNITION_CHAMBER")) {
if (BlockStorage.check(raw_disp.getRelative(BlockFace.EAST).getState().getBlock(), "IGNITION_CHAMBER")) {
chamber = (Hopper) raw_disp.getRelative(BlockFace.EAST).getState();
} else if (BlockStorage.check(raw_disp.getRelative(BlockFace.WEST).getState().getBlock(), "IGNITION_CHAMBER")) {
chamber = (Hopper) raw_disp.getRelative(BlockFace.WEST).getState();
@ -774,11 +772,11 @@ public class SlimefunSetup {
}
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("SMELTERY", "chance.fireBreak"))) {
if(chamber != null) {
if (chamber != null) {
if (chamber.getInventory().contains(Material.FLINT_AND_STEEL)) {
ItemStack item = chamber.getInventory().getItem(chamber.getInventory().first(Material.FLINT_AND_STEEL));
item.setDurability((short) (item.getDurability() + 1));
if(item.getDurability() >= item.getType().getMaxDurability()) {
if (item.getDurability() >= item.getType().getMaxDurability()) {
item.setAmount(0);
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
}
@ -830,7 +828,7 @@ public class SlimefunSetup {
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("PRESSURE_CHAMBER");
if (mb.isMultiBlock(machine)) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
Dispenser disp = (Dispenser) b.getRelative(BlockFace.UP).getRelative(BlockFace.UP).getState();
final Inventory inv = disp.getInventory();
@ -1166,7 +1164,7 @@ public class SlimefunSetup {
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("MAGIC_WORKBENCH");
if (mb.isMultiBlock(machine)) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
Dispenser disp = null;
@ -1406,7 +1404,7 @@ public class SlimefunSetup {
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("ORE_WASHER");
if (mb.isMultiBlock(machine)) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
Dispenser disp = (Dispenser) b.getRelative(BlockFace.UP).getState();
Inventory inv = disp.getInventory();
@ -1895,11 +1893,11 @@ public class SlimefunSetup {
@Override
public boolean onInteract(Player p, MultiBlock mb, Block b) {
if (mb.isMultiBlock(SlimefunItem.getByID("SAW_MILL"))) {
if(CSCoreLib.getLib().getProtectionManager().canBuild(p.getUniqueId(), b.getRelative(BlockFace.UP), true)) {
if (CSCoreLib.getLib().getProtectionManager().canBuild(p.getUniqueId(), b.getRelative(BlockFace.UP), true)) {
if (Slimefun.hasUnlocked(p, SlimefunItems.SAW_MILL, true)) {
if (b.getRelative(BlockFace.UP).getType() == Material.LOG || b.getRelative(BlockFace.UP).getType() == Material.LOG_2) {
Block log = b.getRelative(BlockFace.UP);
if(!BlockStorage.hasBlockInfo(log)) {
if (!BlockStorage.hasBlockInfo(log)) {
ItemStack item = log.getType() == Material.LOG ? new CustomItem(Material.WOOD, log.getData() % 4, 8) : new CustomItem(Material.WOOD, (log.getData() % 2) + 4, 8);
log.getWorld().dropItemNaturally(log.getLocation(), item);
log.getWorld().playEffect(log.getLocation(), Effect.STEP_SOUND, log.getType());
@ -1959,7 +1957,7 @@ public class SlimefunSetup {
@Override
public boolean onInteract(final Player p, MultiBlock mb, final Block b) {
if (mb.isMultiBlock(SlimefunItem.getByID("DIGITAL_MINER"))) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, SlimefunItems.DIGITAL_MINER, true)) {
Chest chest = (Chest) b.getRelative(BlockFace.UP).getState();
final Inventory inv = chest.getInventory();
@ -2037,7 +2035,7 @@ public class SlimefunSetup {
@Override
public boolean onInteract(final Player p, MultiBlock mb, final Block b) {
if (mb.isMultiBlock(SlimefunItem.getByID("ADVANCED_DIGITAL_MINER"))) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, SlimefunItems.ADVANCED_DIGITAL_MINER, true)) {
Chest chest = (Chest) b.getRelative(BlockFace.UP).getState();
final Inventory inv = chest.getInventory();
@ -2126,7 +2124,7 @@ public class SlimefunSetup {
if (e.getClickedBlock() != null) {
SlimefunItem machine = BlockStorage.check(e.getClickedBlock());
if (machine != null && machine.getID().equals("COMPOSTER")) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), e.getClickedBlock(), true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), e.getClickedBlock(), true)) {
final ItemStack input = p.getInventory().getItemInMainHand();
final Block b = e.getClickedBlock();
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
@ -2305,7 +2303,7 @@ public class SlimefunSetup {
@Override
public boolean onInteract(final Player p, MultiBlock mb, final Block b) {
if (mb.isMultiBlock(SlimefunItem.getByID("AUTOMATED_PANNING_MACHINE"))) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
final ItemStack input = p.getInventory().getItemInMainHand();
ItemStack output = null;
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("GOLD_PAN", "chance.SIFTED_ORE"))) output = SlimefunItems.SIFTED_ORE;
@ -2448,7 +2446,7 @@ public class SlimefunSetup {
if (e.getClickedBlock() != null) {
SlimefunItem machine = BlockStorage.check(e.getClickedBlock());
if (machine != null && machine.getID().equals("CRUCIBLE")) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), e.getClickedBlock(), true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), e.getClickedBlock(), true)) {
final ItemStack input = p.getInventory().getItemInMainHand();
final Block block = e.getClickedBlock().getRelative(BlockFace.UP);
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
@ -2809,7 +2807,7 @@ public class SlimefunSetup {
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByID("JUICER");
if (mb.isMultiBlock(machine)) {
if(CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
if (Slimefun.hasUnlocked(p, SlimefunItems.JUICER, true)) {
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
Inventory inv = disp.getInventory();
@ -3998,10 +3996,10 @@ public class SlimefunSetup {
public void tick(Block b, SlimefunItem item, Config data) {
int charge = ChargableBlock.getCharge(b);
if (charge > 0) {
Slimefun.getGPSNetwork().updateTransmitter(b, UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.ONLINE);
Slimefun.getGPSNetwork().updateTransmitter(b, UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.ONLINE);
ChargableBlock.setCharge(b, charge - 1);
}
else Slimefun.getGPSNetwork().updateTransmitter(b, UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.OFFLINE);
else Slimefun.getGPSNetwork().updateTransmitter(b, UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.OFFLINE);
}
@Override
@ -4023,7 +4021,7 @@ public class SlimefunSetup {
@Override
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
Slimefun.getGPSNetwork().updateTransmitter(b, UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.OFFLINE);
Slimefun.getGPSNetwork().updateTransmitter(b, UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.OFFLINE);
return true;
}
});
@ -4036,11 +4034,11 @@ public class SlimefunSetup {
public void tick(Block b, SlimefunItem item, Config data) {
int charge = ChargableBlock.getCharge(b);
if (charge > 2) {
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 4 + 100, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.ONLINE);
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 4 + 100, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.ONLINE);
ChargableBlock.setCharge(b, charge - 3);
}
else {
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 4 + 100, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.OFFLINE);
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 4 + 100, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.OFFLINE);
}
}
@ -4063,7 +4061,7 @@ public class SlimefunSetup {
@Override
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 4 + 100, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.OFFLINE);
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 4 + 100, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.OFFLINE);
return true;
}
});
@ -4076,11 +4074,11 @@ public class SlimefunSetup {
public void tick(Block b, SlimefunItem item, Config data) {
int charge = ChargableBlock.getCharge(b);
if (charge > 10) {
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 16 + 500, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.ONLINE);
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 16 + 500, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.ONLINE);
ChargableBlock.setCharge(b, charge - 11);
}
else {
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 16 + 500, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.OFFLINE);
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 16 + 500, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.OFFLINE);
}
}
@ -4103,7 +4101,7 @@ public class SlimefunSetup {
@Override
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 16 + 500, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.OFFLINE);
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 16 + 500, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.OFFLINE);
return true;
}
});
@ -4116,11 +4114,11 @@ public class SlimefunSetup {
public void tick(Block b, SlimefunItem item, Config data) {
int charge = ChargableBlock.getCharge(b);
if (charge > 45) {
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 64 + 800, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.ONLINE);
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 64 + 800, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.ONLINE);
ChargableBlock.setCharge(b, charge - 46);
}
else {
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 64 + 800, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.OFFLINE);
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 64 + 800, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.OFFLINE);
}
}
@ -4143,7 +4141,7 @@ public class SlimefunSetup {
@Override
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 64 + 800, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), NetworkStatus.OFFLINE);
Slimefun.getGPSNetwork().updateTransmitter(new Location(b.getWorld(), b.getX(), b.getY() * 64 + 800, b.getZ()).getBlock(), UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), NetworkStatus.OFFLINE);
return true;
}
});
@ -4717,7 +4715,7 @@ public class SlimefunSetup {
@Override
public void onInteract(final Player p, final Block b) throws Exception {
GPSNetwork.openTeleporterGUI(p, UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), b, Slimefun.getGPSNetwork().getNetworkComplexity(UUID.fromString(BlockStorage.getBlockInfo(b, "owner"))));
GPSNetwork.openTeleporterGUI(p, UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")), b, Slimefun.getGPSNetwork().getNetworkComplexity(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))));
}
}

View File

@ -984,7 +984,7 @@ public class SlimefunGuide {
if (sfItem != null) {
recipe = sfItem.getRecipe();
recipeType = sfItem.getRecipeType().toItem();
recipeOutput = sfItem.getCustomOutput() != null ? sfItem.getCustomOutput(): sfItem.getItem();
recipeOutput = sfItem.getRecipeOutput() != null ? sfItem.getRecipeOutput(): sfItem.getItem();
}
else {
List<Recipe> recipes = new ArrayList<Recipe>();
@ -1118,7 +1118,7 @@ public class SlimefunGuide {
});
if (sfItem != null) {
if (Slimefun.getItemConfig().contains(sfItem.getName() + ".wiki")) {
if (Slimefun.getItemConfig().contains(sfItem.getID() + ".wiki")) {
try {
menu.addItem(8, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzY2OTJmOTljYzZkNzgyNDIzMDQxMTA1NTM1ODk0ODQyOThiMmU0YTAyMzNiNzY3NTNmODg4ZTIwN2VmNSJ9fX0="), "&rView this Item in our Wiki &7(Slimefun Wiki)", "", "&7\u21E8 Click to open"));
menu.addMenuClickHandler(8, new MenuClickHandler() {
@ -1127,7 +1127,7 @@ public class SlimefunGuide {
public boolean onClick(Player p, int slot, ItemStack item, ClickAction action) {
p.closeInventory();
p.sendMessage("");
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7&o" + Slimefun.getItemConfig().getString(sfItem.getName() + ".wiki")));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7&o" + Slimefun.getItemConfig().getString(sfItem.getID() + ".wiki")));
p.sendMessage("");
return false;
}
@ -1136,7 +1136,7 @@ public class SlimefunGuide {
e.printStackTrace();
}
}
if (Slimefun.getItemConfig().contains(sfItem.getName() + ".youtube")) {
if (Slimefun.getItemConfig().contains(sfItem.getID() + ".youtube")) {
try {
menu.addItem(7, new CustomItem(CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjQzNTNmZDBmODYzMTQzNTM4NzY1ODYwNzViOWJkZjBjNDg0YWFiMDMzMWI4NzJkZjExYmQ1NjRmY2IwMjllZCJ9fX0="), "&rDemonstration Video &7(Youtube)", "", "&7\u21E8 Click to watch"));
menu.addMenuClickHandler(7, new MenuClickHandler() {
@ -1145,7 +1145,7 @@ public class SlimefunGuide {
public boolean onClick(Player p, int slot, ItemStack item, ClickAction action) {
p.closeInventory();
p.sendMessage("");
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7&o" + Slimefun.getItemConfig().getString(sfItem.getName() + ".youtube")));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7&o" + Slimefun.getItemConfig().getString(sfItem.getID() + ".youtube")));
p.sendMessage("");
return false;
}

View File

@ -34,6 +34,7 @@ import me.mrCookieSlime.Slimefun.GitHub.GitHubConnector;
import me.mrCookieSlime.Slimefun.GitHub.GitHubSetup;
import me.mrCookieSlime.Slimefun.Hashing.ItemHash;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Misc.BookDesign;
import me.mrCookieSlime.Slimefun.Objects.MultiBlock;
import me.mrCookieSlime.Slimefun.Objects.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunArmorPiece;
@ -223,7 +224,9 @@ public class SlimefunStartup extends JavaPlugin {
Player p = e.getPlayer();
if (!getWhitelist().getBoolean(p.getWorld().getName() + ".enabled")) return;
if (!getWhitelist().getBoolean(p.getWorld().getName() + ".enabled-items.SLIMEFUN_GUIDE")) return;
p.getInventory().addItem(SlimefunGuide.getItem(config.getBoolean("guide.default-view-book")));
if (config.getBoolean("guide.default-view-book")) p.getInventory().addItem(SlimefunGuide.getItem(BookDesign.BOOK));
else p.getInventory().addItem(SlimefunGuide.getItem(BookDesign.CHEST));
}
}
@ -285,7 +288,7 @@ public class SlimefunStartup extends JavaPlugin {
Class.forName("com.sk89q.worldedit.extent.Extent");
new WESlimefunManager();
System.out.println("[Slimefun] Successfully hooked into WorldEdit!");
} catch(Exception x) {
} catch (Exception x) {
System.err.println("[Slimefun] Failed to hook into WorldEdit!");
System.err.println("[Slimefun] Maybe consider updating WorldEdit or Slimefun?");
}
@ -376,7 +379,7 @@ public class SlimefunStartup extends JavaPlugin {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new BukkitRunnable() {
@Override
public void run() {
exoticGarden = getServer().getPluginManager().isPluginEnabled("ExoticGarden"); //Had to do it this way, otherwise it seems disabled.
exoticGarden = getServer().getPluginManager().isPluginEnabled("ExoticGarden"); // Had to do it this way, otherwise it seems disabled.
}
}, 0);
@ -416,8 +419,7 @@ public class SlimefunStartup extends JavaPlugin {
}
SlimefunBackup.start();
} catch(Exception x) {
}
} catch (Exception x) {}
// Prevent Memory Leaks
config = null;

View File

@ -73,7 +73,7 @@ public class BlockStorage {
try {
World w = Bukkit.getWorld(l.split(";")[0]);
if (w != null) return new Location(w, Integer.parseInt(l.split(";")[1]), Integer.parseInt(l.split(";")[2]), Integer.parseInt(l.split(";")[3]));
} catch(NumberFormatException x) {
} catch (NumberFormatException x) {
}
return null;
}
@ -111,7 +111,7 @@ public class BlockStorage {
ticking_chunks.put(chunk_string, locations);
if (!loaded_tickers.contains(chunk_string)) loaded_tickers.add(chunk_string);
}
} catch(Exception x) {
} catch (Exception x) {
System.err.println("[Slimefun] Failed to load " + file.getName() + "(ERR: " + key + ")");
x.printStackTrace();
}
@ -134,7 +134,7 @@ public class BlockStorage {
for (String key: cfg.getKeys(false)) {
try {
if (world.getName().equals(key.split(";")[0])) map_chunks.put(key, cfg.getString(key));
} catch(Exception x) {
} catch (Exception x) {
System.err.println("[Slimefun] Failed to load " + chunks.getName() + " for World \"" + world.getName() + "\" (ERR: " + key + ")");
x.printStackTrace();
}
@ -157,7 +157,7 @@ public class BlockStorage {
inventories.put(l, new BlockMenu(preset, l, cfg));
}
}
catch(Exception x) {
catch (Exception x) {
}
}
}
@ -264,7 +264,7 @@ public class BlockStorage {
public static ItemStack retrieve(Block block) {
if (!hasBlockInfo(block)) return null;
else {
final SlimefunItem item = SlimefunItem.getByID(getBlockInfo(block, "id"));
final SlimefunItem item = SlimefunItem.getByID(getLocationInfo(block.getLocation(), "id"));
clearBlockInfo(block);
if (item == null) return null;
else return item.getItem();
@ -292,7 +292,7 @@ public class BlockStorage {
}
return cfg;
} catch(Exception x) {
} catch (Exception x) {
System.err.println(x.getClass().getName());
System.err.println("[Slimefun] Failed to parse BlockInfo for Block @ " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ());
try {
@ -339,7 +339,7 @@ public class BlockStorage {
@Deprecated
public static String getBlockInfo(Block block, String key) {
return getBlockInfo(block.getLocation(), key);
return getLocationInfo(block.getLocation(), key);
}
@Deprecated
@ -365,7 +365,7 @@ public class BlockStorage {
public static void addBlockInfo(Location l, String key, String value, boolean updateTicker) {
Config cfg = new Config("data-storage/Slimefun/temp.yml");
if (hasBlockInfo(l)) cfg = getBlockInfo(l);
if (hasBlockInfo(l)) cfg = getLocationInfo(l);
cfg.setValue(key, value);
setBlockInfo(l, cfg, updateTicker);
}
@ -376,7 +376,7 @@ public class BlockStorage {
public static boolean hasBlockInfo(Location l) {
BlockStorage storage = getStorage(l.getWorld());
return storage != null && storage.storage.containsKey(l) && getBlockInfo(l, "id") != null;
return storage != null && storage.storage.containsKey(l) && getLocationInfo(l, "id") != null;
}
public static void setBlockInfo(Block block, Config cfg, boolean updateTicker) {
@ -436,7 +436,7 @@ public class BlockStorage {
public static void _integrated_removeBlockInfo(Location l, boolean destroy) {
BlockStorage storage = getStorage(l.getWorld());
if (hasBlockInfo(l)) {
refreshCache(storage, l, getBlockInfo(l).getString("id"), null, destroy);
refreshCache(storage, l, getLocationInfo(l).getString("id"), null, destroy);
storage.storage.remove(l);
}
@ -477,7 +477,7 @@ public class BlockStorage {
if (!hasBlockInfo(from)) return;
BlockStorage storage = getStorage(from.getWorld());
setBlockInfo(to, getBlockInfo(from), true);
setBlockInfo(to, getLocationInfo(from), true);
if (storage.inventories.containsKey(from)) {
BlockMenu menu = storage.inventories.get(from);
storage.inventories.put(to, menu);
@ -485,7 +485,7 @@ public class BlockStorage {
menu.move(to);
}
refreshCache(storage, from, getBlockInfo(from).getString("id"), null, true);
refreshCache(storage, from, getLocationInfo(from).getString("id"), null, true);
storage.storage.remove(from);
String chunk_string = locationToChunkString(from);
@ -500,11 +500,6 @@ public class BlockStorage {
}
}
@Deprecated
private static void refreshCache(BlockStorage storage, Block b, String key, String value, boolean updateTicker) {
refreshCache(storage, b.getLocation(), key, value, updateTicker);
}
private static void refreshCache(BlockStorage storage, Location l, String key, String value, boolean updateTicker) {
Config cfg = storage.cache_blocks.containsKey(key) ? storage.cache_blocks.get(key): new Config(path_blocks + l.getWorld().getName() + "/" + key + ".sfb");
cfg.setValue(serializeLocation(l), value);
@ -530,7 +525,7 @@ public class BlockStorage {
public static SlimefunItem check(Location l) {
if (!hasBlockInfo(l)) return null;
return SlimefunItem.getByID(getBlockInfo(l, "id"));
return SlimefunItem.getByID(getLocationInfo(l, "id"));
}
public static String checkID(Block block) {
@ -543,16 +538,16 @@ public class BlockStorage {
public static String checkID(Location l) {
if (!hasBlockInfo(l)) return null;
return getBlockInfo(l, "id");
return getLocationInfo(l, "id");
}
public static boolean check(Location l, String slimefunItem) {
if (!hasBlockInfo(l)) return false;
try {
String id = getBlockInfo(l, "id");
String id = getLocationInfo(l, "id");
return id != null && id.equalsIgnoreCase(slimefunItem);
}
catch(NullPointerException x) {
catch (NullPointerException x) {
return false;
}
}
@ -577,7 +572,7 @@ public class BlockStorage {
@Deprecated
public static Set<Block> getTickingBlocks(String chunk) {
Set<Block> ret = new HashSet<Block>();
for(Location l: getTickingLocations(chunk)) {
for (Location l: getTickingLocations(chunk)) {
ret.add(l.getBlock());
}
return ret;
@ -600,7 +595,7 @@ public class BlockStorage {
public void clearInventory(Location l) {
BlockMenu menu = getInventory(l);
for(HumanEntity human: new ArrayList<>(menu.toInventory().getViewers())) {
for (HumanEntity human: new ArrayList<>(menu.toInventory().getViewers())) {
human.closeInventory();
}
@ -654,7 +649,7 @@ public class BlockStorage {
}
return cfg;
} catch(Exception x) {
} catch (Exception x) {
System.err.println(x.getClass().getName());
System.err.println("[Slimefun] Failed to parse ChunkInfo for Chunk @ " + chunk.getX() + ", " + chunk.getZ());
try {

View File

@ -79,21 +79,21 @@ public class TickerTask implements Runnable {
if (item != null) {
machines++;
try {
item.getTicker().update();
if (item.getTicker().isSynchronized()) {
item.getBlockTicker().update();
if (item.getBlockTicker().isSynchronized()) {
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
@Override
public void run() {
try {
long timestamp3 = System.currentTimeMillis();
item.getTicker().tick(b, item, BlockStorage.getBlockInfo(l));
item.getBlockTicker().tick(b, item, BlockStorage.getLocationInfo(l));
map_machinetime.put(item.getID(), (map_machinetime.containsKey(item.getID()) ? map_machinetime.get(item.getID()): 0) + (System.currentTimeMillis() - timestamp3));
map_chunk.put(c, (map_chunk.containsKey(c) ? map_chunk.get(c): 0) + 1);
map_machine.put(item.getID(), (map_machine.containsKey(item.getID()) ? map_machine.get(item.getID()): 0) + 1);
block_timings.put(l, System.currentTimeMillis() - timestamp3);
} catch(Exception x) {
} catch (Exception x) {
int errors = 0;
if (bugged.containsKey(l)) errors = bugged.get(l);
errors++;
@ -197,15 +197,15 @@ public class TickerTask implements Runnable {
}
else {
long timestamp3 = System.currentTimeMillis();
item.getTicker().tick(b, item, BlockStorage.getBlockInfo(l));
item.getBlockTicker().tick(b, item, BlockStorage.getLocationInfo(l));
map_machinetime.put(item.getID(), (map_machinetime.containsKey(item.getID()) ? map_machinetime.get(item.getID()): 0) + (System.currentTimeMillis() - timestamp3));
map_chunk.put(c, (map_chunk.containsKey(c) ? map_chunk.get(c): 0) + 1);
map_machine.put(item.getID(), (map_machine.containsKey(item.getID()) ? map_machine.get(item.getID()): 0) + 1);
block_timings.put(l, System.currentTimeMillis() - timestamp3);
}
tickers.add(item.getTicker());
} catch(Exception x) {
tickers.add(item.getBlockTicker());
} catch (Exception x) {
int errors = 0;
if (bugged.containsKey(l)) errors = bugged.get(l);

View File

@ -71,7 +71,7 @@ public class ChargableBlock {
}
public static int getCharge(Location l) {
String charge = BlockStorage.getBlockInfo(l, "energy-charge");
String charge = BlockStorage.getLocationInfo(l, "energy-charge");
if (charge != null) return Integer.parseInt(charge);
else {
BlockStorage.addBlockInfo(l, "energy-charge", "0", false);
@ -173,7 +173,7 @@ public class ChargableBlock {
}
public static int getMaxCharge(Location l) {
Config cfg = BlockStorage.getBlockInfo(l);
Config cfg = BlockStorage.getLocationInfo(l);
if (!cfg.contains("id")) {
BlockStorage.clearBlockInfo(l);
return 0;

View File

@ -76,7 +76,7 @@ public class EnergyNet extends Network {
public static EnergyNet getNetworkFromLocationOrCreate(Location l) {
EnergyNet energy_network = getNetworkFromLocation(l);
if(energy_network == null) {
if (energy_network == null) {
energy_network = new EnergyNet(l);
registerNetwork(energy_network);
}
@ -96,8 +96,8 @@ public class EnergyNet extends Network {
}
public Network.Component classifyLocation(Location l) {
if(regulator.equals(l)) return Network.Component.REGULATOR;
switch(getComponent(l)) {
if (regulator.equals(l)) return Network.Component.REGULATOR;
switch (getComponent(l)) {
case DISTRIBUTOR:
return Network.Component.CONNECTOR;
case CONSUMER:
@ -109,11 +109,11 @@ public class EnergyNet extends Network {
}
public void locationClassificationChange(Location l, Network.Component from, Network.Component to) {
if(from == Network.Component.TERMINUS) {
if (from == Network.Component.TERMINUS) {
input.remove(l);
output.remove(l);
}
switch(getComponent(l)) {
switch (getComponent(l)) {
case DISTRIBUTOR:
if (ChargableBlock.isCapacitor(l)) storage.add(l);
break;
@ -123,11 +123,13 @@ public class EnergyNet extends Network {
case SOURCE:
input.add(l);
break;
default:
break;
}
}
public void tick(Block b) {
if(!regulator.equals(b.getLocation())) {
if (!regulator.equals(b.getLocation())) {
EnergyHologram.update(b, "&4Multiple Energy Regulators connected");
return;
}
@ -142,7 +144,7 @@ public class EnergyNet extends Network {
for (final Location source: input) {
long timestamp = System.currentTimeMillis();
SlimefunItem item = BlockStorage.check(source);
double energy = item.getEnergyTicker().generateEnergy(source, item, BlockStorage.getBlockInfo(source));
double energy = item.getEnergyTicker().generateEnergy(source, item, BlockStorage.getLocationInfo(source));
if (item.getEnergyTicker().explode(source)) {
BlockStorage.clearBlockInfo(source);

View File

@ -195,7 +195,7 @@ public class CargoManager {
String id = BlockStorage.checkID(block);
if (id.equals("CARGO_NODE_OUTPUT")) return true;
Config blockInfo = BlockStorage.getBlockInfo(block); // Store the returned Config instance to avoid heavy calls
Config blockInfo = BlockStorage.getLocationInfo(block.getLocation()); // Store the returned Config instance to avoid heavy calls
BlockMenu menu = BlockStorage.getInventory(block.getLocation());
boolean lore = blockInfo.getString("filter-lore").equals("true");

View File

@ -45,7 +45,7 @@ public class CargoNet extends Network {
private static int[] slots = new int[] {19, 20, 21, 28, 29, 30, 37, 38, 39};
//Chest Terminal Stuff
// Chest Terminal Stuff
private static final ChestTerminalSorter sorter = new ChestTerminalSorter();
public static final int[] terminal_slots = new int[] {0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 42};
private static final ItemStack terminal_noitem_item = new CustomItem(new MaterialData(Material.BARRIER), "&4No Item cached");
@ -63,7 +63,7 @@ public class CargoNet extends Network {
public static CargoNet getNetworkFromLocationOrCreate(Location l) {
CargoNet cargo_network = getNetworkFromLocation(l);
if(cargo_network == null) {
if (cargo_network == null) {
cargo_network = new CargoNet(l);
registerNetwork(cargo_network);
}
@ -95,7 +95,7 @@ public class CargoNet extends Network {
public Network.Component classifyLocation(Location l) {
String id = BlockStorage.checkID(l);
if(id == null) return null;
if (id == null) return null;
switch(id) {
case "CARGO_MANAGER":
return Component.REGULATOR;
@ -114,7 +114,7 @@ public class CargoNet extends Network {
}
public void locationClassificationChange(Location l, Component from, Component to) {
if(from == Component.TERMINUS) {
if (from == Component.TERMINUS) {
inputNodes.remove(l);
outputNodes.remove(l);
advancedOutputNodes.remove(l);
@ -122,7 +122,7 @@ public class CargoNet extends Network {
imports.remove(l);
exports.remove(l);
}
if(to == Component.TERMINUS) {
if (to == Component.TERMINUS) {
switch(BlockStorage.checkID(l)) {
case "CARGO_NODE_INPUT":
inputNodes.add(l);
@ -147,7 +147,7 @@ public class CargoNet extends Network {
}
public void tick(final Block b) {
if(!regulator.equals(b.getLocation())) {
if (!regulator.equals(b.getLocation())) {
CargoHologram.update(b, "&4Multiple Cargo Regulators connected");
return;
}
@ -163,16 +163,16 @@ public class CargoNet extends Network {
final Map<Integer, List<Location>> output = new HashMap<Integer, List<Location>>();
for(Location outputNode: outputNodes) {
for (Location outputNode: outputNodes) {
Integer frequency = getFrequency(outputNode);
if(!output.containsKey(frequency)) {
if (!output.containsKey(frequency)) {
output.put(frequency, new ArrayList<Location>());
}
output.get(frequency).add(outputNode);
}
for(Location outputNode: advancedOutputNodes) {
for (Location outputNode: advancedOutputNodes) {
Integer frequency = getFrequency(outputNode);
if(!output.containsKey(frequency)) {
if (!output.containsKey(frequency)) {
output.put(frequency, new ArrayList<Location>());
}
output.get(frequency).add(outputNode);
@ -181,14 +181,14 @@ public class CargoNet extends Network {
//Chest Terminal Stuff
final Set<Location> providers = new HashSet<Location>();
final Set<Location> destinations;
if(output.containsKey(16)) {
if (output.containsKey(16)) {
destinations = new HashSet<Location>(output.get(16));
} else {
destinations = new HashSet<Location>();
}
for(Location inputNode: inputNodes) {
for (Location inputNode: inputNodes) {
int frequency = getFrequency(inputNode);
if(frequency == 16) {
if (frequency == 16) {
providers.add(inputNode);
}
}
@ -199,7 +199,7 @@ public class CargoNet extends Network {
@Override
public void run() {
if (BlockStorage.getBlockInfo(b, "visualizer") == null) {
if (BlockStorage.getLocationInfo(b.getLocation(), "visualizer") == null) {
self.display();
}
//Chest Terminal Code
@ -238,7 +238,7 @@ public class CargoNet extends Network {
}
if (!items.isEmpty()) {
int index = Integer.parseInt(BlockStorage.getBlockInfo(bus, "index"));
int index = Integer.parseInt(BlockStorage.getLocationInfo(bus, "index"));
index++;
if (index > (items.size() - 1)) index = 0;
@ -324,20 +324,20 @@ public class CargoNet extends Network {
}
}
}
//All operations happen here: Everything gets iterated from the Input Nodes. (Apart from ChestTerminal Buses)
// All operations happen here: Everything gets iterated from the Input Nodes. (Apart from ChestTerminal Buses)
for (Location input: inputNodes) {
Integer frequency = getFrequency(input);
if(frequency < 0 || frequency > 15) {
if (frequency < 0 || frequency > 15) {
continue;
}
Block inputTarget = getAttachedBlock(input.getBlock());
ItemStack stack = null;
int previousSlot = -1;
boolean roundrobin = BlockStorage.getBlockInfo(input, "round-robin").equals("true");
boolean roundrobin = BlockStorage.getLocationInfo(input, "round-robin").equals("true");
if (inputTarget != null) {
ItemSlot slot = CargoManager.withdraw(input.getBlock(), storage, inputTarget, Integer.parseInt(BlockStorage.getBlockInfo(input, "index")));
ItemSlot slot = CargoManager.withdraw(input.getBlock(), storage, inputTarget, Integer.parseInt(BlockStorage.getLocationInfo(input, "index")));
if (slot != null) {
stack = slot.getItem();
previousSlot = slot.getSlot();
@ -418,8 +418,8 @@ public class CargoNet extends Network {
}
else if (storage.hasInventory(target.getLocation())) {
BlockMenu menu = BlockStorage.getInventory(target.getLocation());
if (BlockStorage.checkID(target.getLocation()).startsWith("BARREL_") && BlockStorage.getBlockInfo(target.getLocation(), "storedItems") != null) {
int stored = Integer.valueOf(BlockStorage.getBlockInfo(target.getLocation(), "storedItems"));
if (BlockStorage.checkID(target.getLocation()).startsWith("BARREL_") && BlockStorage.getLocationInfo(target.getLocation(), "storedItems") != null) {
int stored = Integer.valueOf(BlockStorage.getLocationInfo(target.getLocation(), "storedItems"));
for (int slot: menu.getPreset().getSlotsAccessedByItemTransport(menu, ItemTransportFlow.WITHDRAW, null)) {
ItemStack is = menu.getItemInSlot(slot);
if (is != null && CargoManager.matchesFilter(l.getBlock(), is, -1)) {
@ -480,7 +480,7 @@ public class CargoNet extends Network {
for (final Location l: terminals) {
BlockMenu menu = BlockStorage.getInventory(l);
int page = Integer.parseInt(BlockStorage.getBlockInfo(l, "page"));
int page = Integer.parseInt(BlockStorage.getLocationInfo(l, "page"));
if (!items.isEmpty() && items.size() < (page - 1) * terminal_slots.length + 1) {
page = 1;
BlockStorage.addBlockInfo(l, "page", String.valueOf(1));
@ -556,7 +556,7 @@ public class CargoNet extends Network {
private static int getFrequency(Location l) {
int freq = 0;
try {
freq = Integer.parseInt(BlockStorage.getBlockInfo(l).getString("frequency"));
freq = Integer.parseInt(BlockStorage.getLocationInfo(l).getString("frequency"));
} catch (Exception e) {}
return freq;
}

View File

@ -24,8 +24,8 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
public class Projector {
public static ArmorStand getArmorStand(Block projector) {
String nametag = ChatColor.translateAlternateColorCodes('&', BlockStorage.getBlockInfo(projector, "text"));
double offset = Double.valueOf(BlockStorage.getBlockInfo(projector, "offset"));
String nametag = ChatColor.translateAlternateColorCodes('&', BlockStorage.getLocationInfo(projector.getLocation(), "text"));
double offset = Double.valueOf(BlockStorage.getLocationInfo(projector.getLocation(), "offset"));
Location l = new Location(projector.getWorld(), projector.getX() + 0.5, projector.getY() + offset, projector.getZ() + 0.5);
for (Entity n: l.getChunk().getEntities()) {
@ -42,7 +42,7 @@ public class Projector {
public static void openEditor(Player p, final Block projector) {
ChestMenu menu = new ChestMenu("Hologram Settings");
menu.addItem(0, new CustomItem(new MaterialData(Material.NAME_TAG), "&7Text &e(Click to edit)", "", "&r" + ChatColor.translateAlternateColorCodes('&', BlockStorage.getBlockInfo(projector, "text"))));
menu.addItem(0, new CustomItem(new MaterialData(Material.NAME_TAG), "&7Text &e(Click to edit)", "", "&r" + ChatColor.translateAlternateColorCodes('&', BlockStorage.getLocationInfo(projector.getLocation(), "text"))));
menu.addMenuClickHandler(0, new MenuClickHandler() {
@Override
@ -64,12 +64,12 @@ public class Projector {
}
});
menu.addItem(1, new CustomItem(new MaterialData(Material.WATCH), "&7Offset: &e" + DoubleHandler.fixDouble(Double.valueOf(BlockStorage.getBlockInfo(projector, "offset")) + 1.0D), "", "&rLeft Click: &7+0.1", "&rRight Click: &7-0.1"));
menu.addItem(1, new CustomItem(new MaterialData(Material.WATCH), "&7Offset: &e" + DoubleHandler.fixDouble(Double.valueOf(BlockStorage.getLocationInfo(projector.getLocation(), "offset")) + 1.0D), "", "&rLeft Click: &7+0.1", "&rRight Click: &7-0.1"));
menu.addMenuClickHandler(1, new MenuClickHandler() {
@Override
public boolean onClick(Player p, int arg1, ItemStack arg2, ClickAction arg3) {
double offset = DoubleHandler.fixDouble(Double.valueOf(BlockStorage.getBlockInfo(projector, "offset")) + (arg3.isRightClicked() ? -0.1F: 0.1F));
double offset = DoubleHandler.fixDouble(Double.valueOf(BlockStorage.getLocationInfo(projector.getLocation(), "offset")) + (arg3.isRightClicked() ? -0.1F: 0.1F));
ArmorStand hologram = getArmorStand(projector);
Location l = new Location(projector.getWorld(), projector.getX() + 0.5, projector.getY() + offset, projector.getZ() + 0.5);
hologram.teleport(l);

View File

@ -34,6 +34,7 @@ public class BlockListener implements Listener {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@SuppressWarnings("deprecation")
@EventHandler
public void onBlockFall(EntityChangeBlockEvent event) {
if (event.getEntity() instanceof FallingBlock) {

View File

@ -13,6 +13,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
*
* @since 4.1.11
*/
@SuppressWarnings("deprecation")
public class ItemPickupListener implements Listener {
public ItemPickupListener(SlimefunStartup plugin) {

View File

@ -45,7 +45,7 @@ public class TeleporterListener implements Listener {
}
}
else if (item.getID().equals("GPS_ACTIVATION_DEVICE_PERSONAL")) {
if (BlockStorage.getBlockInfo(e.getClickedBlock(), "owner").equals(e.getPlayer().getUniqueId().toString())) {
if (BlockStorage.getLocationInfo(e.getClickedBlock().getLocation(), "owner").equals(e.getPlayer().getUniqueId().toString())) {
SlimefunItem teleporter = BlockStorage.check(e.getClickedBlock().getRelative(BlockFace.DOWN));
if (teleporter instanceof Teleporter) {