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

Code cleanup and doing the requested changes.

This commit is contained in:
ajan-12 2019-09-01 12:38:43 +03:00
parent 4c30764dac
commit d5a8bade3e
2 changed files with 70 additions and 69 deletions

View File

@ -10,10 +10,6 @@ public final class Messages {
public static void setup() {
local.setPrefix("&aSlimefun &7> ");
local.setDefault("messages.not-researched", "&4You do not have enough Knowledge to understand this");
local.setDefault("messages.not-enough-xp", "&4You do not have enough XP to unlock this");
local.setDefault("messages.unlocked", "&bYou have unlocked &7\"%research%\"");
local.setDefault("messages.fortune-cookie", new String[] {"&7Help me, I am trapped in a Fortune Cookie Factory!", "&7You will die tomorrow... by a Creeper", "&7At some Point in your Life something bad will happen!!!", "&7Next week you will notice that this is not the real World, you are in a kind of \"Matrix\" or lets call it Computer game. Yes you are in a Computer Game", "&7This Cookie will taste good in a few seconds", "&7You will die soon and the last word you will hear is gonna be \"EXTERMINATE!!!\"", "&7Whatever you do, do not hug a Creeper... I tried it. It feels good, but it's not worth it."});
local.setDefault("commands.help", "Displays this Help Screen");
local.setDefault("commands.cheat", "Allows you to cheat Items");
local.setDefault("commands.give", "Give somebody some Slimefun Items");
@ -23,7 +19,14 @@ public final class Messages {
local.setDefault("commands.teleporter", "See other Player's Waypoints");
local.setDefault("commands.versions", "Lists all installed Addons");
local.setDefault("commands.open_guide", "Opens Slimefun's guide without using the book");
local.setDefault("commands.stats", "Shows some Stats about a Player");
local.setDefault("commands.research.reset", "&cYou have reset %player%'s Knowledge");
local.setDefault("commands.research.reset-target", "&cYour Knowledge has been reset");
local.setDefault("messages.not-researched", "&4You do not have enough Knowledge to understand this");
local.setDefault("messages.not-enough-xp", "&4You do not have enough XP to unlock this");
local.setDefault("messages.unlocked", "&bYou have unlocked &7\"%research%\"");
local.setDefault("messages.fortune-cookie", "&7Help me, I am trapped in a Fortune Cookie Factory!", "&7You will die tomorrow... by a Creeper", "&7At some Point in your Life something bad will happen!!!", "&7Next week you will notice that this is not the real World, you are in a kind of \"Matrix\" or lets call it Computer game. Yes you are in a Computer Game", "&7This Cookie will taste good in a few seconds", "&7You will die soon and the last word you will hear is gonna be \"EXTERMINATE!!!\"", "&7Whatever you do, do not hug a Creeper... I tried it. It feels good, but it's not worth it.");
local.setDefault("messages.only-players", "&4This Command is only for Players");
local.setDefault("messages.no-permission", "&4You do not have the required Permission to do this");
local.setDefault("messages.usage", "&4Usage: &c%usage%");
@ -59,22 +62,28 @@ public final class Messages {
local.setDefault("messages.disabled-item", "&4&lThis Item has been disabled! How did you even get that?");
local.setDefault("messages.research.start", "&7The Ancient Spirits whisper mysterious Words into your Ear!");
local.setDefault("messages.research.progress", "&7You start to wonder about &b%research% &e(%progress%)");
local.setDefault("commands.stats", "Shows some Stats about a Player");
local.setDefault("messages.fire-extinguish", "&7You have extinguished yourself");
local.setDefault("messages.cannot-place" ,"&cYou cannot place that block there!");
local.setDefault("machines.pattern-not-found", "&eSorry, I could not recognize this Pattern. Please place the Items in the correct Pattern into the Dispenser.");
local.setDefault("machines.unknown-material", "&eSorry, I could not recognize the Item in my Dispenser. Please put something in that I know.");
local.setDefault("machines.wrong-item", "&eSorry, I could not recognize the Item you right clicked me with. Check the Recipes and see which Items you can use.");
local.setDefault("machines.full-inventory", "&eSorry, my Inventory is too full!");
local.setDefault("miner.no-ores", "&eSorry, I could not find any Ores nearby!");
local.setDefault("backpack.already-open", "&cSorry, this backpack is open somewhere else!");
local.setDefault("backpack.no-stack", "&cYou cannot stack Backpacks");
local.setDefault("workbench.not-enhanced", "&4You cannot use Slimefun Items in a normal Workbench");
local.setDefault("anvil.not-working", "&4You cannot use Slimefun Items in an Anvil");
local.setDefault("commands.research.reset", "&cYou have reset %player%'s Knowledge");
local.setDefault("commands.research.reset-target", "&cYour Knowledge has been reset");
local.setDefault("machines.in-use", "&cThis Block's Inventory is currently opened by a different Player.");
local.setDefault("machines.ignition-chamber-no-flint", "&cIgnition Chamber is missing Flint and Steel.");
local.setDefault("messages.cannot-place" ,"&cYou cannot place that block there!");
local.setDefault("anvil.not-working", "&4You cannot use Slimefun Items in an Anvil");
local.setDefault("backpack.already-open", "&cSorry, this backpack is open somewhere else!");
local.setDefault("backpack.no-stack", "&cYou cannot stack Backpacks");
local.setDefault("miner.no-ores", "&eSorry, I could not find any Ores nearby!");
local.setDefault("workbench.not-enhanced", "&4You cannot use Slimefun Items in a normal Workbench");
local.setDefault("machines.ANCIENT_ALTAR.not-enough-pedestals", "&4The Altar is not surrounded by the needed Amount of Pedestals &c(%pedestals% / 8)");
local.setDefault("machines.ANCIENT_ALTAR.unknown-catalyst", "&4Unknown Catalyst! &cUse the correct Recipe instead!");
local.setDefault("machines.ANCIENT_ALTAR.unknown-recipe", "&4Unknown Recipe! &cUse the correct Recipe instead!");
local.setDefault("machines.ANCIENT_PEDESTAL.obstructed", "&4Pedestal is obstructed! &cRemove anything above the pedestal!");
local.setDefault("machines.HOLOGRAM_PROJECTOR.enter-text", "&7Please enter your desired Hologram Text in your Chat. &r(Color Codes are supported!)");
local.setDefault("machines.ELEVATOR.no-destinations", "&4No Destinations found");
local.setDefault("machines.CARGO_NODES.must-be-placed", "&4Must be placed onto a Chest or Machine");
local.setDefault("gps.waypoint.new", "&ePlease type in a Name for your new Waypoint in the Chat. &7(Color Codes supported!)");
local.setDefault("gps.waypoint.added", "&aSuccessfully added a new Waypoint");
@ -86,14 +95,6 @@ public final class Messages {
local.setDefault("robot.stopped", "&7Your Robot has paused its Script");
local.setDefault("inventory.no-access", "&4You are not permitted to access this Block");
local.setDefault("machines.ANCIENT_ALTAR.not-enough-pedestals", "&4The Altar is not surrounded by the needed Amount of Pedestals &c(%pedestals% / 8)");
local.setDefault("machines.ANCIENT_ALTAR.unknown-catalyst", "&4Unknown Catalyst! &cUse the correct Recipe instead!");
local.setDefault("machines.ANCIENT_ALTAR.unknown-recipe", "&4Unknown Recipe! &cUse the correct Recipe instead!");
local.setDefault("machines.ANCIENT_PEDESTAL.obstructed", "&4Pedestal is obstructed! &cRemove anything above the pedestal!");
local.setDefault("machines.HOLOGRAM_PROJECTOR.enter-text", "&7Please enter your desired Hologram Text in your Chat. &r(Color Codes are supported!)");
local.setDefault("machines.ELEVATOR.no-destinations", "&4No Destinations found");
local.setDefault("machines.CARGO_NODES.must-be-placed", "&4Must be placed onto a Chest or Machine");
local.setDefault("android.scripts.already-uploaded", "&4This Script has already been uploaded.");
local.setDefault("android.scripts.enter-name", "", "&ePlease type in a Name for your Script", "");
local.setDefault("android.scripts.uploaded", "&bUploading...", "&aSuccessfully uploaded your Script!");

View File

@ -50,6 +50,8 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import io.github.thebusybiscuit.cscorelib2.materials.MaterialTools;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionManager;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectionModule;
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.compatibility.MaterialHelper;
@ -885,14 +887,11 @@ public final class SlimefunSetup {
List<String> SFitemML = SFitemM.getLore();
if (itemML.size() < 6) {
// Index 1 and 3 in SlimefunItems.STAFF_STORM has lores with words and stuff so we check for them.
if (!itemML.get(1).equals(SFitemML.get(1))) return false;
if (!itemML.get(3).equals(SFitemML.get(3))) return false;
} else return false;
if (itemML.get(1).equals(SFitemML.get(1)) && itemML.get(3).equals(SFitemML.get(3))) {
if (p.getFoodLevel() >= 4 || p.getGameMode() == GameMode.CREATIVE) {
Location loc = p.getTargetBlock(null, 50).getLocation();
if (loc.getWorld() == null) return false;
if (!loc.getChunk().isLoaded()) return false;
if (loc.getWorld() != null && loc.getChunk().isLoaded()) {
if (new ProtectionManager(Bukkit.getServer()).hasPermission(p, loc, ProtectionModule.Action.PVP)) {
loc.getWorld().strikeLightning(loc);
if (p.getInventory().getItemInMainHand().getType() != Material.SHEARS && p.getGameMode() != GameMode.CREATIVE) {
@ -903,23 +902,18 @@ public final class SlimefunSetup {
if (ChatColor.translateAlternateColorCodes('&', "&e5 Uses &7left").equals(itemML.get(4))) {
itemML.set(4, ChatColor.translateAlternateColorCodes('&', "&e4 Uses &7left"));
}
else if (ChatColor.translateAlternateColorCodes('&', "&e4 Uses &7left").equals(itemML.get(4))) {
} else if (ChatColor.translateAlternateColorCodes('&', "&e4 Uses &7left").equals(itemML.get(4))) {
itemML.set(4, ChatColor.translateAlternateColorCodes('&', "&e3 Uses &7left"));
}
else if (ChatColor.translateAlternateColorCodes('&', "&e3 Uses &7left").equals(itemML.get(4))) {
} else if (ChatColor.translateAlternateColorCodes('&', "&e3 Uses &7left").equals(itemML.get(4))) {
itemML.set(4, ChatColor.translateAlternateColorCodes('&', "&e2 Uses &7left"));
}
else if (ChatColor.translateAlternateColorCodes('&', "&e2 Uses &7left").equals(itemML.get(4))) {
} else if (ChatColor.translateAlternateColorCodes('&', "&e2 Uses &7left").equals(itemML.get(4))) {
itemML.set(4, ChatColor.translateAlternateColorCodes('&', "&e1 Use &7left"));
}
else if (ChatColor.translateAlternateColorCodes('&', "&e1 Use &7left").equals(itemML.get(4))) {
} else if (ChatColor.translateAlternateColorCodes('&', "&e1 Use &7left").equals(itemML.get(4))) {
e.setCancelled(true);
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
item.setAmount(0);
return true;
}
else return false;
} else return false;
e.setCancelled(true);
// Saving the changes to lore and item.
@ -927,15 +921,21 @@ public final class SlimefunSetup {
item.setItemMeta(itemM);
if (e.getParentEvent().getHand() == EquipmentSlot.HAND) {
p.getInventory().setItemInMainHand(item);
}
else {
} else {
p.getInventory().setItemInOffHand(item);
}
} else {
Messages.local.sendTranslation(p, "messages.no-pvp", true);
}
}
} else {
Messages.local.sendTranslation(p, "messages.hungry", true);
}
return true;
} else return false;
}
}
}
return false;
}
});