Skip to content

Commit

Permalink
(+) Sync official latest source
Browse files Browse the repository at this point in the history
(+) Translate some texts
  • Loading branch information
StarWishsama committed Jun 26, 2019
1 parent db5d8ea commit 06ce571
Show file tree
Hide file tree
Showing 45 changed files with 775 additions and 884 deletions.
74 changes: 37 additions & 37 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,42 +83,42 @@
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.14-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.TheBusyBiscuit</groupId>
<artifactId>CS-CoreLib</artifactId>
<version>v1.6</version>
</dependency>
<dependency>
<groupId>me.minebuilders</groupId>
<artifactId>clearlag-core</artifactId>
<version>2.9.7</version>
</dependency>
<dependency>
<groupId>net.coreprotect</groupId>
<artifactId>coreprotect</artifactId>
<version>2.16.0</version>
</dependency>
<dependency>
<groupId>me.mrCookieSlime</groupId>
<artifactId>EmeraldEnchants</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>me.mrCookieSlime</groupId>
<artifactId>ExoticGarden</artifactId>
<version>1.7.0</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.14.2-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>com.github.TheBusyBiscuit</groupId>
<artifactId>CS-CoreLib</artifactId>
<version>v1.6.1</version>
</dependency>
<dependency>
<groupId>me.minebuilders</groupId>
<artifactId>clearlag-core</artifactId>
<version>2.9.7</version>
</dependency>
<dependency>
<groupId>net.coreprotect</groupId>
<artifactId>coreprotect</artifactId>
<version>2.16.3</version>
</dependency>
<dependency>
<groupId>me.mrCookieSlime</groupId>
<artifactId>EmeraldEnchants</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>me.mrCookieSlime</groupId>
<artifactId>ExoticGarden</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
15 changes: 11 additions & 4 deletions src/me/mrCookieSlime/Slimefun/AncientAltar/AltarRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ public class AltarRecipe {

public AltarRecipe(List<ItemStack> input, ItemStack output) {
this.catalyst = input.get(4);
this.input = new ArrayList<ItemStack>();
for (int i = 0; i < input.size(); i++) {
if (i != 4) this.input.add(input.get(i));
}
this.input = new ArrayList<>();
this.input.add(input.get(0));
this.input.add(input.get(1));
this.input.add(input.get(2));
this.input.add(input.get(5));

this.input.add(input.get(8));
this.input.add(input.get(7));
this.input.add(input.get(6));
this.input.add(input.get(3));

this.output = output;

Pedestals.recipes.add(this);
Expand Down
83 changes: 36 additions & 47 deletions src/me/mrCookieSlime/Slimefun/AncientAltar/Pedestals.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,34 @@

public class Pedestals {

public static List<AltarRecipe> recipes = new ArrayList<AltarRecipe>();
public static List<AltarRecipe> recipes = new ArrayList<>();

public static List<Block> getPedestals(Block altar) {
List<Block> list = new ArrayList<Block>();

List<Block> list = new ArrayList<>();
if (BlockStorage.check(altar.getRelative(2, 0, -2), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(2, 0, -2));
}
if (BlockStorage.check(altar.getRelative(3, 0, 0), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(3, 0, 0));
}
if (BlockStorage.check(altar.getRelative(-3, 0, 0), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(-3, 0, 0));
}
if (BlockStorage.check(altar.getRelative(0, 0, 3), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(0, 0, 3));
}
if (BlockStorage.check(altar.getRelative(0, 0, -3), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(0, 0, -3));
}
if (BlockStorage.check(altar.getRelative(2, 0, 2), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(2, 0, 2));
}
if (BlockStorage.check(altar.getRelative(2, 0, -2), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(2, 0, -2));
if (BlockStorage.check(altar.getRelative(0, 0, 3), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(0, 0, 3));
}
if (BlockStorage.check(altar.getRelative(-2, 0, 2), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(-2, 0, 2));
}
if (BlockStorage.check(altar.getRelative(-3, 0, 0), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(-3, 0, 0));
}
if (BlockStorage.check(altar.getRelative(-2, 0, -2), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(-2, 0, -2));
}
if (BlockStorage.check(altar.getRelative(0, 0, -3), "ANCIENT_PEDESTAL")) {
list.add(altar.getRelative(0, 0, -3));
}

return list;
}
Expand All @@ -62,38 +61,28 @@ public static ItemStack getRecipeOutput(ItemStack catalyst, List<ItemStack> inpu
return checkRecipe(catalyst, input);
}

private static ItemStack checkRecipe(ItemStack catalyst, List<ItemStack> input) {
AltarRecipe r = null;
for (AltarRecipe recipe : recipes) {
if (SlimefunManager.isItemSimiliar(catalyst, recipe.getCatalyst(), true)) {
r = recipe;

List<ItemStack> copy = new ArrayList<ItemStack>(input);

recipe:
for (ItemStack item : recipe.getInput()) {
Iterator<ItemStack> iterator = copy.iterator();
boolean match = false;

items:
while (iterator.hasNext()) {
ItemStack altar_item = iterator.next();
if (SlimefunManager.isItemSimiliar(altar_item, item, true)) {
match = true;
iterator.remove();
break items;
}
}

if (!match) {
r = null;
break recipe;
}
}
private static ItemStack checkRecipe(ItemStack catalyst, List<ItemStack> items) {
loop:
for (AltarRecipe recipe: recipes) {
if (!SlimefunManager.isItemSimiliar(catalyst, recipe.getCatalyst(), true)) {
continue;
}

for (int i = 0; i < 8; i++) {
if (!SlimefunManager.isItemSimiliar(items.get(i), recipe.getInput().get(0), true)) {
continue;
}

for (int j = 1; j < 8; j++) {
if (!SlimefunManager.isItemSimiliar(items.get((i + j) % items.size()), recipe.getInput().get(j), true)) {
continue loop;
}
}

return recipe.getOutput();
}
}

if (r != null) return r.getOutput();
}
}
return null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
private static final ItemStack[] fish = new ItemStack[] {new ItemStack(Material.COD), new ItemStack(Material.SALMON), new ItemStack(Material.PUFFERFISH), new ItemStack(Material.TROPICAL_FISH), new ItemStack(Material.STRING), new ItemStack(Material.BONE), new ItemStack(Material.STICK)};

private static final List<BlockFace> directions = Arrays.asList(BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST);
private static final List<Material> blockblacklist = new ArrayList<Material>();
private static final List<Material> blockblacklist = new ArrayList<>();

static {
blockblacklist.add(Material.BEDROCK);
Expand All @@ -84,7 +84,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
blockblacklist.add(Material.REPEATING_COMMAND_BLOCK);
}

private Set<MachineFuel> recipes = new HashSet<MachineFuel>();
private Set<MachineFuel> recipes = new HashSet<>();

public String getInventoryTitle() {
return "可编程式机器人";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
import java.net.URLConnection;

import org.bukkit.plugin.Plugin;
import com.google.gson.JsonArray;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.json.simple.JSONValue;

public class CSCoreLibLoader {
Expand Down Expand Up @@ -62,9 +65,11 @@ private boolean connect() {
connection.setDoOutput(true);

final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
final JSONArray array = (JSONArray) JSONValue.parse(reader.readLine());
download = traceURL(((String) ((JSONObject) array.get(array.size() - 1)).get("downloadUrl")).replace("https:", "http:"));
file = new File("plugins/" + (String) ((JSONObject) array.get(array.size() - 1)).get("name") + ".jar");
final JsonArray array = new JsonParser().parse(reader).getAsJsonArray();
final JsonObject json = array.get(array.size() - 1).getAsJsonObject();

download = traceURL(json.get("downloadUrl").getAsString().replace("https:", "http:"));
file = new File("plugins/" + json.get("name").getAsString() + ".jar");

return true;
} catch (IOException e) {
Expand Down
7 changes: 3 additions & 4 deletions src/me/mrCookieSlime/Slimefun/Commands/SlimefunCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public class SlimefunCommand implements CommandExecutor, Listener {

public SlimefunStartup plugin;

public static List<String> arguments = new ArrayList<String>();
public static List<String> descriptions = new ArrayList<String>();
public static List<String> tabs = new ArrayList<String>();
public static List<String> arguments = new ArrayList<>();
public static List<String> descriptions = new ArrayList<>();
public static List<String> tabs = new ArrayList<>();

public SlimefunCommand(SlimefunStartup plugin) {
this.plugin = plugin;
Expand Down Expand Up @@ -92,7 +92,6 @@ public SlimefunCommand(SlimefunStartup plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}

@SuppressWarnings("deprecation")
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length == 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/me/mrCookieSlime/Slimefun/GEO/OreGenSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public class OreGenSystem {

public static Map<String, OreGenResource> map = new HashMap<String, OreGenResource>();
public static Map<String, OreGenResource> map = new HashMap<>();

public static Collection<OreGenResource> listResources() {
return map.values();
Expand Down
2 changes: 1 addition & 1 deletion src/me/mrCookieSlime/Slimefun/GPS/Elevator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

public class Elevator {

public static List<UUID> ignored = new ArrayList<UUID>();
public static List<UUID> ignored = new ArrayList<>();

public static void openEditor(Player p, final Block b) {
ChestMenu menu = new ChestMenu("电梯设置");
Expand Down
4 changes: 2 additions & 2 deletions src/me/mrCookieSlime/Slimefun/GPS/GPSNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@

public class GPSNetwork {

private Map<UUID, Set<Location>> transmitters = new HashMap<UUID, Set<Location>>();
private Map<UUID, Set<Location>> transmitters = new HashMap<>();
private int[] border = new int[] {0, 1, 3, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53};
private int[] inventory = new int[] {19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42, 43};

public void updateTransmitter(Block b, UUID uuid, NetworkStatus status) {
Set<Location> set = new HashSet<Location>();
Set<Location> set = new HashSet<>();
if (transmitters.containsKey(uuid)) set = transmitters.get(uuid);
if (status.equals(NetworkStatus.ONLINE)) {
if (!set.contains(b.getLocation())) {
Expand Down
4 changes: 2 additions & 2 deletions src/me/mrCookieSlime/Slimefun/GPS/TeleportationSequence.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

public class TeleportationSequence {

public static Set<UUID> players = new HashSet<UUID>();
public static Set<UUID> players = new HashSet<>();

public static void start(UUID uuid, int complexity, Location source, Location destination, boolean resistance) {
players.add(uuid);
Expand Down Expand Up @@ -53,7 +53,7 @@ private static void cancel(UUID uuid, Player p) {
players.remove(uuid);
if (p != null) {
try {
TitleBuilder title = (TitleBuilder) new TitleBuilder(20, 60, 20).addText(ChatColor.translateAlternateColorCodes('&', "&4Teleportation cancelled"));
TitleBuilder title = (TitleBuilder) new TitleBuilder(20, 60, 20).addText(ChatColor.translateAlternateColorCodes('&', "&4传送已取消"));
TitleBuilder subtitle = (TitleBuilder) new TitleBuilder(20, 60, 20).addText(ChatColor.translateAlternateColorCodes('&', "&40%"));

title.send(TitleType.TITLE, p);
Expand Down
2 changes: 1 addition & 1 deletion src/me/mrCookieSlime/Slimefun/Hashing/ItemHash.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ItemHash {

public static MessageDigest digest;
public static int LENGTH;
public static Map<String, SlimefunItem> map = new HashMap<String, SlimefunItem>();
public static Map<String, SlimefunItem> map = new HashMap<>();

static {
try {
Expand Down
6 changes: 3 additions & 3 deletions src/me/mrCookieSlime/Slimefun/Objects/Research.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public class Research {
* @since 4.0
* @see ResearchSetup
*/
public static List<Research> list = new ArrayList<Research>();
public static List<Research> list = new ArrayList<>();
/**
* Contains all the players (UUIDs) that are currently unlocking a research.
* @since 4.0
*/
public static List<UUID> researching = new ArrayList<UUID>();
public static List<UUID> researching = new ArrayList<>();
/**
* Whether researching in creative is free.
* @since 4.0
Expand Down Expand Up @@ -87,7 +87,7 @@ public Research(int id, String name, int cost) {
this.id = id;
this.name = name;
this.cost = cost;
this.items = new ArrayList<SlimefunItem>();
this.items = new ArrayList<>();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ protected void tick(Block b) {
ItemStack item = menu.getItemInSlot(getInputSlots()[j]);

if (item != null && item.getAmount() == 1) return;
builder.append(CustomItemSerializer.serialize(item, ItemFlag.DATA, ItemFlag.ITEMMETA_DISPLAY_NAME, ItemFlag.ITEMMETA_LORE, ItemFlag.MATERIAL));

builder.append(CustomItemSerializer.serialize(item, ItemFlag.MATERIAL, ItemFlag.ITEMMETA_DISPLAY_NAME, ItemFlag.ITEMMETA_LORE));

i++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) {
if (flow.equals(ItemTransportFlow.INSERT)) {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.REACTOR_COOLANT_CELL, true)) return getCoolantSlots();
else if (SlimefunManager.isItemSimiliar(item, SlimefunItems.NETHER_ICE_COOLANT_CELL, true)) return getCoolantSlots();
else return getFuelSlots();
}
else return getOutputSlots();
Expand Down
Loading

0 comments on commit 06ce571

Please sign in to comment.