Browse Source

Push several fixes to upstream

master 2.23.3-SNAPSHOT
Stefatorus 10 months ago
parent
commit
e42b9cb6a0
  1. 2
      .classpath
  2. 60
      src/cx/sfy/LagAssist/Data.java
  3. 2
      src/cx/sfy/LagAssist/mobs/SmartMob.java
  4. 7
      src/cx/sfy/LagAssist/utils/V1_13.java

2
.classpath

@ -14,7 +14,7 @@
<classpathentry kind="lib" path="W:/Minecraft Versions/Paper-1.13.2-b624.jar"/>
<classpathentry kind="lib" path="W:/Minecraft Versions/Paper-1.12.2-b1618.jar"/>
<classpathentry kind="lib" path="W:/Minecraft Versions/PaperSpigot-1.8.8-R0.1-SNAPSHOT-latest.jar"/>
<classpathentry kind="lib" path="W:/Minecraft Versions/Spigot-1.15.jar"/>
<classpathentry kind="lib" path="W:/Custom Plugins/Vault.jar"/>
<classpathentry kind="lib" path="W:/Minecraft Versions/spigot-1.16.4.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

60
src/cx/sfy/LagAssist/Data.java

@ -39,42 +39,44 @@ public class Data {
e.printStackTrace();
}
if (!data.contains("version")) {
if (data.contains("hoppers")) {
for (String rawh : data.getConfigurationSection("hoppers").getKeys(false)) {
String loc = "hoppers." + rawh;
List<String> values = data.getStringList(loc);
data.set(loc, null);
data.set(loc + ".materials", values);
}
}
}
data.set("version", 1);
saveData();
}
}
private static long last;
private static void saveData() {
//
// if (System.currentTimeMillis() - last < 1000) {
// return;
// }
//
//
// Bukkit.getScheduler().runTaskAsynchronously(Main.p, () -> {
try {
data.save(dataf);
} catch (IOException e) {
e.printStackTrace();
if (System.currentTimeMillis() - last < 3000) {
return;
}
// });
last = System.currentTimeMillis();
Bukkit.getScheduler().runTaskAsynchronously(Main.p, () -> {
try {
data.save(dataf);
} catch (IOException e) {
e.printStackTrace();
}
});
}
private static short genMapId() {
@ -99,32 +101,32 @@ public class Data {
}
}
public static void deleteHopper(Hopper h) {
String cloc = "hoppers." + WorldMgr.serializeLocation(h.getLocation());
data.set(cloc, null);
saveData();
}
public static boolean isSellHopper(Location loc) {
String cloc = "hoppers." + WorldMgr.serializeLocation(loc);
return data.getBoolean(cloc + ".sellhopper", false);
}
public static boolean toggleSellHopper(Player p, Location loc) {
String cloc = "hoppers." + WorldMgr.serializeLocation(loc);
String owner = data.getString(cloc + ".owner", "NONE");
if (!(p.getUniqueId().toString().equals(owner) || p.hasPermission("lagassist.hopper.bypass"))) {
p.sendMessage(Main.PREFIX + "You can't toggle selling for a hopper not owned by you");
return false;
}
String percentage = "§e" + SellHoppers.getMultiplierPercentage(Bukkit.getOfflinePlayer(p.getUniqueId())) + "%";
if (isSellHopper(loc)) {
data.set(cloc + ".sellhopper", false);
p.sendMessage(Main.PREFIX + "This sellhopper has been §cdisabled§f at " + percentage + "§f.");
@ -138,7 +140,7 @@ public class Data {
}
}
public static OfflinePlayer getOwningPlayer(Location loc) {
public static OfflinePlayer getOwningPlayer(Location loc) {
String cloc = "hoppers." + WorldMgr.serializeLocation(loc);
if (data.contains(cloc + ".owner")) {

2
src/cx/sfy/LagAssist/mobs/SmartMob.java

@ -27,6 +27,8 @@ import cx.sfy.LagAssist.utils.WorldMgr;
public class SmartMob implements Listener {
EventPriority prio;
private static SplittableRandom rand = new SplittableRandom();
public static boolean Spawning;

7
src/cx/sfy/LagAssist/utils/V1_13.java

@ -64,13 +64,18 @@ public class V1_13 {
public static List<ItemStack> getLootTable(Entity ent) {
LootTables lt = LootTables.valueOf(ent.getType().toString());
// TODO: FIX in 1.16
// java.lang.IllegalArgumentException:
// Missing required parameters:
// [<parameter minecraft:this_entity>, <parameter minecraft:damage_source>]
List<ItemStack> itms = new ArrayList<ItemStack>();
if (lt == null) {
return itms;
}
itms.addAll(lt.getLootTable().populateLoot(r, new LootContext.Builder(ent.getLocation()).build()));
itms.addAll(lt.getLootTable().populateLoot(r, new LootContext.Builder(ent.getLocation()).lootedEntity(ent).build()));
return itms;
}

Loading…
Cancel
Save