Permalink
Browse files

Updated to Minecraft 1.12, and Java 8.

  • Loading branch information...
me4502 committed May 18, 2017
1 parent 0cdf875 commit e3845796e72e2f4805342fd499ac2f855dfaf166
Showing with 647 additions and 993 deletions.
  1. +3 −3 pom.xml
  2. +1 −3 src/main/java/com/me4502/util/GenerateConfiguration.java
  3. +1 −3 src/main/java/com/me4502/util/GenerateWikiICList.java
  4. +49 −56 src/main/java/com/me4502/util/GenerateWikiICPages.java
  5. +3 −4 src/main/java/com/sk89q/craftbook/bukkit/BukkitConfiguration.java
  6. +5 −15 src/main/java/com/sk89q/craftbook/bukkit/CraftBookPlugin.java
  7. +8 −17 src/main/java/com/sk89q/craftbook/bukkit/MechanicListenerAdapter.java
  8. +2 −7 src/main/java/com/sk89q/craftbook/bukkit/Metrics.java
  9. +2 −8 src/main/java/com/sk89q/craftbook/bukkit/util/BukkitUtil.java
  10. +6 −6 src/main/java/com/sk89q/craftbook/bukkit/util/PlayerUtil.java
  11. +1 −1 src/main/java/com/sk89q/craftbook/core/LanguageManager.java
  12. +3 −8 src/main/java/com/sk89q/craftbook/core/st/SelfTriggeringManager.java
  13. +7 −18 src/main/java/com/sk89q/craftbook/mechanics/BetterLeads.java
  14. +30 −38 src/main/java/com/sk89q/craftbook/mechanics/BetterPistons.java
  15. +5 −9 src/main/java/com/sk89q/craftbook/mechanics/BetterPlants.java
  16. +2 −6 src/main/java/com/sk89q/craftbook/mechanics/Bookcase.java
  17. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/BounceBlocks.java
  18. +9 −16 src/main/java/com/sk89q/craftbook/mechanics/Chair.java
  19. +2 −8 src/main/java/com/sk89q/craftbook/mechanics/ChunkAnchor.java
  20. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/CookingPot.java
  21. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/Elevator.java
  22. +3 −8 src/main/java/com/sk89q/craftbook/mechanics/Footprints.java
  23. +1 −6 src/main/java/com/sk89q/craftbook/mechanics/HiddenSwitch.java
  24. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/LightSwitch.java
  25. +2 −2 src/main/java/com/sk89q/craftbook/mechanics/PaintingSwitch.java
  26. +3 −3 src/main/java/com/sk89q/craftbook/mechanics/Snow.java
  27. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/TreeLopper.java
  28. +1 −2 src/main/java/com/sk89q/craftbook/mechanics/XPStorer.java
  29. +3 −14 src/main/java/com/sk89q/craftbook/mechanics/area/Area.java
  30. +3 −17 src/main/java/com/sk89q/craftbook/mechanics/area/AreaCommands.java
  31. +4 −6 src/main/java/com/sk89q/craftbook/mechanics/area/CopyManager.java
  32. +2 −5 src/main/java/com/sk89q/craftbook/mechanics/area/CuboidCopy.java
  33. +4 −4 src/main/java/com/sk89q/craftbook/mechanics/area/FlatCuboidCopy.java
  34. +4 −8 src/main/java/com/sk89q/craftbook/mechanics/area/simple/Bridge.java
  35. +2 −2 src/main/java/com/sk89q/craftbook/mechanics/area/simple/CuboidToggleMechanic.java
  36. +4 −8 src/main/java/com/sk89q/craftbook/mechanics/area/simple/Door.java
  37. +3 −9 src/main/java/com/sk89q/craftbook/mechanics/area/simple/Gate.java
  38. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/arrows/AbstractArrow.java
  39. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/arrows/ElementalArrowsMechanic.java
  40. +2 −2 src/main/java/com/sk89q/craftbook/mechanics/cauldron/CauldronItemStack.java
  41. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/cauldron/ImprovedCauldron.java
  42. +4 −4 src/main/java/com/sk89q/craftbook/mechanics/cauldron/ImprovedCauldronCookbook.java
  43. +3 −3 src/main/java/com/sk89q/craftbook/mechanics/cauldron/legacy/Cauldron.java
  44. +3 −3 src/main/java/com/sk89q/craftbook/mechanics/cauldron/legacy/CauldronCookbook.java
  45. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/crafting/CraftingItemStack.java
  46. +6 −6 src/main/java/com/sk89q/craftbook/mechanics/crafting/CustomCrafting.java
  47. +4 −4 src/main/java/com/sk89q/craftbook/mechanics/crafting/RecipeCommands.java
  48. +16 −15 src/main/java/com/sk89q/craftbook/mechanics/crafting/RecipeManager.java
  49. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/dispenser/DispenserRecipes.java
  50. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/drops/CustomDropDefinition.java
  51. +7 −7 src/main/java/com/sk89q/craftbook/mechanics/drops/CustomDrops.java
  52. +5 −6 src/main/java/com/sk89q/craftbook/mechanics/drops/legacy/LegacyCustomDropManager.java
  53. +6 −11 src/main/java/com/sk89q/craftbook/mechanics/drops/legacy/LegacyCustomDrops.java
  54. +3 −3 src/main/java/com/sk89q/craftbook/mechanics/headdrops/HeadDrops.java
  55. +6 −35 src/main/java/com/sk89q/craftbook/mechanics/ic/ICCommands.java
  56. +8 −8 src/main/java/com/sk89q/craftbook/mechanics/ic/ICManager.java
  57. +37 −45 src/main/java/com/sk89q/craftbook/mechanics/ic/ICMechanic.java
  58. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/PersistentIC.java
  59. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/logic/Clock.java
  60. +1 −7 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/logic/Delayer.java
  61. +3 −7 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/logic/LowDelayer.java
  62. +3 −7 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/logic/NotDelayer.java
  63. +3 −7 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/logic/NotLowDelayer.java
  64. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/logic/RangedOutput.java
  65. +3 −15 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/blocks/BlockReplacer.java
  66. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/blocks/BonemealTerraformer.java
  67. +10 −6 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/blocks/FlexibleSetBlock.java
  68. +2 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/blocks/Planter.java
  69. +1 −3 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/blocks/SetBridge.java
  70. +1 −3 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/blocks/SetDoor.java
  71. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/blocks/Spigot.java
  72. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/entity/AnimalBreeder.java
  73. +0 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/entity/AnimalHarvester.java
  74. +1 −2 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/entity/EntityTrap.java
  75. +6 −5 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/entity/TeleportTransmitter.java
  76. +3 −3 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/items/AutomaticCrafter.java
  77. +1 −2 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/items/ContainerCollector.java
  78. +2 −3 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/items/ContainerDispenser.java
  79. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/items/ContainerStacker.java
  80. +1 −2 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/items/ContainerStocker.java
  81. +2 −3 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/items/Distributer.java
  82. +2 −2 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/items/RangedCollector.java
  83. +2 −3 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/items/Sorter.java
  84. +8 −13 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/miscellaneous/FlameThrower.java
  85. +2 −2 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/miscellaneous/Jukebox.java
  86. +4 −10 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/miscellaneous/Melody.java
  87. +2 −3 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/miscellaneous/PotionInducer.java
  88. +6 −11 ...ain/java/com/sk89q/craftbook/mechanics/ic/gates/world/miscellaneous/ProgrammableFireworkShow.java
  89. +2 −2 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/miscellaneous/RadioPlayer.java
  90. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/miscellaneous/RadioStation.java
  91. +3 −4 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/miscellaneous/SentryGun.java
  92. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/miscellaneous/WirelessTransmitter.java
  93. +2 −2 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/sensors/BlockSensor.java
  94. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/sensors/PlayerSensor.java
  95. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/weather/TimeFaker.java
  96. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/ic/gates/world/weather/WeatherFaker.java
  97. +3 −3 src/main/java/com/sk89q/craftbook/mechanics/ic/plc/PlcFactory.java
  98. +3 −11 src/main/java/com/sk89q/craftbook/mechanics/ic/plc/PlcIC.java
  99. +9 −9 src/main/java/com/sk89q/craftbook/mechanics/ic/plc/lang/Perlstone.java
  100. +3 −3 src/main/java/com/sk89q/craftbook/mechanics/items/CommandItemCommands.java
  101. +7 −7 src/main/java/com/sk89q/craftbook/mechanics/items/CommandItemDefinition.java
  102. +31 −51 src/main/java/com/sk89q/craftbook/mechanics/items/CommandItems.java
  103. +9 −13 src/main/java/com/sk89q/craftbook/mechanics/minecart/ExitRemover.java
  104. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/minecart/StationManager.java
  105. +2 −7 src/main/java/com/sk89q/craftbook/mechanics/minecart/TemporaryCart.java
  106. +10 −10 src/main/java/com/sk89q/craftbook/mechanics/minecart/blocks/CartDeposit.java
  107. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/minecart/blocks/CartMessenger.java
  108. +21 −20 src/main/java/com/sk89q/craftbook/mechanics/pipe/Pipes.java
  109. +1 −1 src/main/java/com/sk89q/craftbook/mechanics/signcopier/SignCopier.java
  110. +3 −10 src/main/java/com/sk89q/craftbook/mechanics/variables/VariableCommands.java
  111. +5 −5 src/main/java/com/sk89q/craftbook/mechanics/variables/VariableManager.java
  112. +3 −3 src/main/java/com/sk89q/craftbook/util/BlockUtil.java
  113. +3 −7 src/main/java/com/sk89q/craftbook/util/CartUtil.java
  114. +1 −1 src/main/java/com/sk89q/craftbook/util/CompatabilityUtil.java
  115. +1 −1 src/main/java/com/sk89q/craftbook/util/EntityUtil.java
  116. +1 −1 src/main/java/com/sk89q/craftbook/util/EnumUtil.java
  117. +3 −12 src/main/java/com/sk89q/craftbook/util/EventUtil.java
  118. +2 −3 src/main/java/com/sk89q/craftbook/util/ICUtil.java
  119. +8 −10 src/main/java/com/sk89q/craftbook/util/InventoryUtil.java
  120. +2 −2 src/main/java/com/sk89q/craftbook/util/ItemInfo.java
  121. +4 −18 src/main/java/com/sk89q/craftbook/util/ItemSyntax.java
  122. +16 −16 src/main/java/com/sk89q/craftbook/util/ItemUtil.java
  123. +2 −2 src/main/java/com/sk89q/craftbook/util/LocationUtil.java
  124. +1 −1 src/main/java/com/sk89q/craftbook/util/LogListBlock.java
  125. +2 −2 src/main/java/com/sk89q/craftbook/util/ParsingUtil.java
  126. +1 −1 src/main/java/com/sk89q/craftbook/util/PlayerType.java
  127. +1 −1 src/main/java/com/sk89q/craftbook/util/RailUtil.java
  128. +3 −3 src/main/java/com/sk89q/craftbook/util/SearchArea.java
  129. +1 −1 src/main/java/com/sk89q/craftbook/util/compat/NoCheatPlusCompatability.java
  130. +1 −1 src/main/java/com/sk89q/craftbook/util/jinglenote/JingleNoteManager.java
  131. +3 −9 src/main/java/com/sk89q/craftbook/util/jinglenote/MidiJingleSequencer.java
  132. +10 −14 src/main/java/com/sk89q/craftbook/util/jinglenote/Playlist.java
  133. +10 −15 src/main/java/com/sk89q/craftbook/util/jinglenote/StringJingleSequencer.java
  134. +1 −1 src/main/java/com/sk89q/craftbook/util/persistent/DummyPersistentStorage.java
  135. +3 −9 src/main/java/com/sk89q/craftbook/util/persistent/SQLitePersistentStorage.java
  136. +43 −45 src/main/java/org/wikipedia/Wiki.java
  137. +4 −10 src/test/java/com/sk89q/craftbook/BaseTestCase.java
  138. +11 −17 src/test/java/com/sk89q/craftbook/mechanics/TreeLopperTest.java
  139. +1 −2 src/test/java/com/sk89q/craftbook/mechanics/boat/BoatDropsTest.java
  140. +2 −2 src/test/java/com/sk89q/craftbook/mechanics/boat/BoatExitRemoverTest.java
  141. +2 −2 src/test/java/com/sk89q/craftbook/mechanics/ic/gates/logic/LogicICTests.java
  142. +1 −1 src/test/java/com/sk89q/craftbook/util/ArrayUtilTest.java
  143. +3 −3 src/test/java/com/sk89q/craftbook/util/ItemUtilTest.java
  144. +1 −1 src/test/java/com/sk89q/craftbook/util/VerifyUtilTest.java
View
@@ -58,7 +58,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version>
<version>1.12-pre2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
@@ -175,8 +175,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
@@ -67,9 +67,7 @@ public void generate(String[] args) {
e.printStackTrace();
}
List<String> mechs = new ArrayList<String>();
mechs.addAll(CraftBookPlugin.availableMechanics.keySet());
List<String> mechs = new ArrayList<>(CraftBookPlugin.availableMechanics.keySet());
Collections.sort(mechs);
@@ -76,9 +76,7 @@ public void generate(String[] args) {
writer.println("<strong style=\"color: red\">*</strong>Requires the permission '''craftbook.ic.restricted.*''' or the respective '''craftbook.ic.mc''XXXX''''' permission.");
writer.close();
} catch (SecurityException e) {
e.printStackTrace();
} catch (IOException e) {
} catch (SecurityException | IOException e) {
e.printStackTrace();
}
}
@@ -11,7 +11,6 @@
import java.util.Map;
import java.util.Set;
import javax.security.auth.login.FailedLoginException;
import javax.security.auth.login.LoginException;
import org.apache.commons.lang.StringUtils;
@@ -48,7 +47,7 @@ public void generate(String[] args) {
try {
boolean upload = false;
final List<String> toUpload = new ArrayList<String>();
final List<String> toUpload = new ArrayList<>();
for(String arg : args) {
@@ -76,7 +75,7 @@ else if(upload)
int missingComments = 0;
final Set<String> missingDocuments = new HashSet<String>();
final Set<String> missingDocuments = new HashSet<>();
for(RegisteredICFactory ric : ICManager.inst().getICList()) {
@@ -208,73 +207,67 @@ else if(upload)
if(upload) {
Bukkit.getScheduler().runTaskAsynchronously(CraftBookPlugin.inst(), new Runnable() {
@Override
public void run () {
Bukkit.getLogger().info("Starting Upload");
Wiki wiki = new Wiki("wiki.sk89q.com");
wiki.setMaxLag(0);
wiki.setThrottle(5000);
wiki.setResolveRedirects(true);
try {
Bukkit.getLogger().info("Logging In");
wiki.login(username, password);
Bukkit.getLogger().info("Logged in Successfully!");
int amount = 0;
String failed = "";
for(RegisteredICFactory ric : ICManager.inst().getICList()) {
if(toUpload.contains("ALL") || toUpload.contains(ric.getId())) {
if(missingDocuments.contains(ric.getId())) {
if(failed.length() == 0)
failed = ric.getId();
else
failed = failed + "," + ric.getId();
continue; //Ignore this, bad docs.
}
Bukkit.getScheduler().runTaskAsynchronously(CraftBookPlugin.inst(), () -> {
Bukkit.getLogger().info("Starting Upload");
Wiki wiki = new Wiki("wiki.sk89q.com");
wiki.setMaxLag(0);
wiki.setThrottle(5000);
wiki.setResolveRedirects(true);
try {
Bukkit.getLogger().info("Logging In");
wiki.login(username, password);
Bukkit.getLogger().info("Logged in Successfully!");
int amount = 0;
String failed = "";
for(RegisteredICFactory ric : ICManager.inst().getICList()) {
if(toUpload.contains("ALL") || toUpload.contains(ric.getId())) {
if(missingDocuments.contains(ric.getId())) {
if(failed.length() == 0)
failed = ric.getId();
else
failed = failed + "," + ric.getId();
continue; //Ignore this, bad docs.
}
Bukkit.getLogger().info("Uploading " + ric.getId() + "...");
Bukkit.getLogger().info("Uploading " + ric.getId() + "...");
StringBuilder builder = new StringBuilder();
StringBuilder builder = new StringBuilder();
BufferedReader reader = new BufferedReader(new FileReader(new File(file, ric.getId() + ".txt")));
BufferedReader reader = new BufferedReader(new FileReader(new File(file, ric.getId() + ".txt")));
String line = null;
String line = null;
while((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
while((line = reader.readLine()) != null) {
builder.append(line);
builder.append("\n");
}
reader.close();
reader.close();
wiki.edit("CraftBook/" + ric.getId(), builder.toString(), "Automated update of '" + ric.getId() + "' by " + username);
wiki.edit("CraftBook/" + ric.getId(), builder.toString(), "Automated update of '" + ric.getId() + "' by " + username);
Bukkit.getLogger().info("Uploaded: " + ric.getId());
Bukkit.getLogger().info("Uploaded: " + ric.getId());
amount++;
}
amount++;
}
Bukkit.getLogger().info("Finished uploading! Uploaded " + amount + " IC Pages!");
if(failed.length() > 0)
Bukkit.getLogger().warning("Failed to upload ICs: " + failed);
} catch (LoginException e) {
e.printStackTrace();
Bukkit.getLogger().warning("Failed to login to wiki!");
} catch (IOException e) {
e.printStackTrace();
}
Bukkit.getLogger().info("Finished uploading! Uploaded " + amount + " IC Pages!");
if(failed.length() > 0)
Bukkit.getLogger().warning("Failed to upload ICs: " + failed);
} catch (LoginException e) {
e.printStackTrace();
Bukkit.getLogger().warning("Failed to login to wiki!");
} catch (IOException e) {
e.printStackTrace();
}
});
}
} catch (SecurityException e) {
e.printStackTrace();
} catch (IOException e) {
} catch (SecurityException | IOException e) {
e.printStackTrace();
}
}
@@ -2,7 +2,6 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;
@@ -86,7 +85,7 @@ public void load() {
config.setComment("enabled-mechanics", "List of mechanics to enable! If they aren't in this list, the server won't load them!");
enabledMechanics = config.getStringList("enabled-mechanics", Collections.singletonList("Variables"));
List<String> disabledMechanics = new ArrayList<String>();
List<String> disabledMechanics = new ArrayList<>();
for(String mech : CraftBookPlugin.availableMechanics.keySet()) {
if(!enabledMechanics.contains(mech))
@@ -139,7 +138,7 @@ public void load() {
debugLogToFile = config.getBoolean("debug-mode-file-logging", false);
config.setComment("debug-flags", "Enable certain debug types when debug mode is enabled.");
debugFlags = config.getStringList("debug-flags", new ArrayList<String>());
debugFlags = config.getStringList("debug-flags", new ArrayList<>());
config.setComment("easter-eggs", "Enables random easter eggs. Can be from console messages on startup for a special occasion, to funny little effects with IC's and other mechanics (Always harmless, won't mess anything up)");
easterEggs = config.getBoolean("easter-eggs", true);
@@ -163,7 +162,7 @@ public void save() {
config.setProperty("enabled-mechanics", enabledMechanics);
List<String> disabledMechanics = new ArrayList<String>();
List<String> disabledMechanics = new ArrayList<>();
for(String mech : CraftBookPlugin.availableMechanics.keySet()) {
if(!enabledMechanics.contains(mech))
@@ -132,7 +132,7 @@
public boolean useLegacyCartSystem = false;
static {
availableMechanics = new TreeMap<String, Class<? extends CraftBookMechanic>>();
availableMechanics = new TreeMap<>();
availableMechanics.put("Variables", VariableManager.class);
availableMechanics.put("CommandItems", CommandItems.class);
@@ -390,12 +390,8 @@ public void playerJoin(PlayerJoinEvent event) {
}
if(!foundAMech) {
Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
@Override
public void run () {
getLogger().warning(ChatColor.RED + "Warning! You have no mechanics enabled, the plugin will appear to do nothing until a feature is enabled!");
}
}, 20L, 20*60*5);
Bukkit.getScheduler().runTaskTimer(this,
() -> getLogger().warning(ChatColor.RED + "Warning! You have no mechanics enabled, the plugin will appear to do nothing until a feature is enabled!"), 20L, 20*60*5);
}
}
@@ -419,15 +415,9 @@ public void setupCraftBook() {
languageManager = new LanguageManager();
languageManager.init();
getServer().getScheduler().runTask(this, new Runnable() {
@Override
public void run () {
CompatabilityUtil.init();
}
});
getServer().getScheduler().runTask(this, CompatabilityUtil::init);
mechanics = new ArrayList<CraftBookMechanic>();
mechanics = new ArrayList<>();
logDebugMessage("Initializing Mechanisms!", "startup");
@@ -68,7 +68,7 @@
*/
final class MechanicListenerAdapter implements Listener {
private Set<String> signClickTimer = new HashSet<String>();
private Set<String> signClickTimer = new HashSet<>();
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerInteract(final PlayerInteractEvent event) {
@@ -99,12 +99,7 @@ public void onPlayerInteract(final PlayerInteractEvent event) {
return;
} else {
signClickTimer.add(event.getPlayer().getName());
Bukkit.getScheduler().runTaskLater(CraftBookPlugin.inst(), new Runnable() {
@Override
public void run () {
signClickTimer.remove(event.getPlayer().getName());
}
}, CraftBookPlugin.inst().getConfiguration().signClickTimeout);
Bukkit.getScheduler().runTaskLater(CraftBookPlugin.inst(), () -> signClickTimer.remove(event.getPlayer().getName()), CraftBookPlugin.inst().getConfiguration().signClickTimeout);
}
}
SignClickEvent ev = new SignClickEvent(event.getPlayer(), action, event.getItem(), block, event.getBlockFace());
@@ -344,16 +339,12 @@ private static void handleDirectWireInput(WorldVector pt, Block sourceBlock, int
CraftBookPlugin.inst().getServer().getPluginManager().callEvent(event);
if(CraftBookPlugin.inst().useLegacyCartSystem) {
CraftBookPlugin.server().getScheduler().runTask(CraftBookPlugin.inst(), new Runnable() {
@Override
public void run() {
try {
CartMechanismBlocks cmb = CartMechanismBlocks.find(event.getBlock());
CartBlockRedstoneEvent ev = new CartBlockRedstoneEvent(event.getBlock(), event.getSource(), event.getOldCurrent(), event.getNewCurrent(), cmb, CartBlockMechanism.getCart(cmb.rail));
CraftBookPlugin.inst().getServer().getPluginManager().callEvent(ev);
} catch (InvalidMechanismException ignored) {
}
CraftBookPlugin.server().getScheduler().runTask(CraftBookPlugin.inst(), () -> {
try {
CartMechanismBlocks cmb = CartMechanismBlocks.find(event.getBlock());
CartBlockRedstoneEvent ev = new CartBlockRedstoneEvent(event.getBlock(), event.getSource(), event.getOldCurrent(), event.getNewCurrent(), cmb, CartBlockMechanism.getCart(cmb.rail));
CraftBookPlugin.inst().getServer().getPluginManager().callEvent(ev);
} catch (InvalidMechanismException ignored) {
}
});
}
@@ -247,12 +247,7 @@ public boolean isOptOut() {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
} catch (InvalidConfigurationException ex) {
} catch (IOException | InvalidConfigurationException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
@@ -620,7 +615,7 @@ private static String urlEncode(final String text) throws UnsupportedEncodingExc
/**
* The set of plotters that are contained within this graph
*/
private final Set<Plotter> plotters = new LinkedHashSet<Plotter>();
private final Set<Plotter> plotters = new LinkedHashSet<>();
private Graph(final String name) {
this.name = name;
@@ -79,16 +79,10 @@ public static Sign toSign(ChangedSign sign) {
}
}
private static final Map<String, LocalWorld> wlw = new HashMap<String, LocalWorld>();
private static final Map<String, LocalWorld> wlw = new HashMap<>();
public static LocalWorld getLocalWorld(World w) {
LocalWorld lw = wlw.get(w.getName());
if (lw == null) {
lw = new BukkitWorld(w);
wlw.put(w.getName(), lw);
}
return lw;
return wlw.computeIfAbsent(w.getName(), k -> new BukkitWorld(w));
}
public static Vector toVector(Block block) {
Oops, something went wrong.

0 comments on commit e384579

Please sign in to comment.