bandaid-fix cartographer crash until Paper adds StructureLocateEvent

This commit is contained in:
dfsek
2020-10-24 23:13:51 -07:00
parent b2468234fb
commit 85ae0344a1
6 changed files with 41 additions and 27 deletions

View File

@@ -6,10 +6,13 @@ import com.dfsek.terra.util.StructureTypeEnum;
import org.bukkit.entity.EnderSignal;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Villager;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.VillagerAcquireTradeEvent;
import org.bukkit.event.entity.VillagerCareerChangeEvent;
import org.polydev.gaea.GaeaPlugin;
public class EventListener implements Listener {
@@ -36,4 +39,15 @@ public class EventListener implements Listener {
} else main.getLogger().warning("No overrides are defined for Strongholds. Ender Signals will not work correctly.");
}
}
@EventHandler
public void onCartographerChange(VillagerAcquireTradeEvent e) {
if(((Villager) e.getEntity()).getProfession().equals(Villager.Profession.CARTOGRAPHER)) e.setCancelled(true); // Cancel leveling if the villager is a Cartographer, to prevent crashing server.
}
@EventHandler
public void onCartographerLevel(VillagerCareerChangeEvent e) {
if(e.getProfession().equals(Villager.Profession.CARTOGRAPHER)) {
e.getEntity().setProfession(Villager.Profession.NITWIT); // Give villager new profession to prevent server crash.
e.setCancelled(true);
}
}
}

View File

@@ -193,7 +193,7 @@ public class ConfigPack extends YamlConfiguration {
try {
config = new ConfigPack(folder.toFile());
if(configs.containsKey(config.getID())) {
Bukkit.getLogger().severe("Duplicate Config Pack ID: \"" + config.getID() + "\"");
//Bukkit.getLogger().severe("Duplicate Config Pack ID: \"" + config.getID() + "\"");
continue;
}
configs.put(config.getID(), config);

View File

@@ -1,4 +1,4 @@
id: OVERWORLD_DEMO
id: DEFAULT
grids:
- OCEAN_DEEP
- OCEAN_DEEP
@@ -49,8 +49,8 @@ grids:
- MOUNTAIN
- MOUNTAIN
frequencies:
grid-x: 3072
grid-z: 2048
grid-x: 5120
grid-z: 6144
zone: 4096
blend:
enable: true

View File

@@ -1,16 +1,15 @@
files:
stronghold: 1
id: "STRONGHOLD"
jungle1: 1
id: "JUNGLE"
spawn:
start:
min: 16
max: 64
min: 72
max: 72
bound:
min: 12
max: 84
width: 1000
padding: 500
min: 48
max: 96
width: 250
padding: 50
loot:
1: wood_house
2: cobble_house
3: cobble_house
0: arrows
1: cobble_house

View File

@@ -8,7 +8,7 @@ spawn:
bound:
min: 48
max: 96
width: 100
padding: 100
width: 250
padding: 500
loot:
1: arrows

View File

@@ -1,15 +1,16 @@
files:
jungle1: 1
id: "JUNGLE"
stronghold: 1
id: "STRONGHOLD"
spawn:
start:
min: 72
max: 72
min: 16
max: 64
bound:
min: 48
max: 96
width: 250
padding: 50
min: 12
max: 84
width: 1000
padding: 500
loot:
0: arrows
1: cobble_house
1: wood_house
2: cobble_house
3: cobble_house