Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-08 04:20:06 +01:00
Update towny hook / fix pattern traverser
Dieser Commit ist enthalten in:
Ursprung
abd886acd7
Commit
418cfa6d03
@ -4,10 +4,7 @@ import com.boydti.fawe.bukkit.FaweBukkit;
|
|||||||
import com.boydti.fawe.object.FawePlayer;
|
import com.boydti.fawe.object.FawePlayer;
|
||||||
import com.palmergames.bukkit.towny.Towny;
|
import com.palmergames.bukkit.towny.Towny;
|
||||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
||||||
import com.palmergames.bukkit.towny.object.PlayerCache;
|
import com.palmergames.bukkit.towny.object.*;
|
||||||
import com.palmergames.bukkit.towny.object.TownBlock;
|
|
||||||
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
|
||||||
import com.palmergames.bukkit.towny.object.WorldCoord;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -28,18 +25,30 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
|
|||||||
if (block == null) {
|
if (block == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Resident resident;
|
||||||
try {
|
try {
|
||||||
if (block.getResident().getName().equals(player.getName())) {
|
resident = TownyUniverse.getDataSource().getResident(player.getName());
|
||||||
return true;
|
try {
|
||||||
}
|
if (block.getResident().equals(resident)) {
|
||||||
} catch (final Exception ignore) {}
|
|
||||||
if (player.hasPermission("fawe.towny.*")) {
|
|
||||||
return true;
|
|
||||||
} else try {
|
|
||||||
if (block.getTown().isMayor(TownyUniverse.getDataSource().getResident(player.getName()))) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (NotRegisteredException ignore) {}
|
} catch (NotRegisteredException ignore) {}
|
||||||
|
Town town = block.getTown();
|
||||||
|
if (town.isMayor(resident)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!town.hasResident(resident)) return false;
|
||||||
|
if (player.hasPermission("fawe.towny.*")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (String rank : resident.getTownRanks()) {
|
||||||
|
if (player.hasPermission("fawe.towny." + rank)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (NotRegisteredException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,21 +66,7 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
|
|||||||
if (myplot == null) {
|
if (myplot == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
boolean isMember = false;
|
boolean isMember = isAllowed(player, myplot);
|
||||||
try {
|
|
||||||
if (myplot.getResident().getName().equals(player.getName())) {
|
|
||||||
isMember = true;
|
|
||||||
}
|
|
||||||
} catch (final Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if (!isMember) {
|
|
||||||
if (player.hasPermission("fawe.towny.*")) {
|
|
||||||
isMember = true;
|
|
||||||
} else if (myplot.getTown().isMayor(TownyUniverse.getDataSource().getResident(player.getName()))) {
|
|
||||||
isMember = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isMember) {
|
if (isMember) {
|
||||||
final Chunk chunk = location.getChunk();
|
final Chunk chunk = location.getChunk();
|
||||||
final Location pos1 = new Location(location.getWorld(), chunk.getX() * 16, 0, chunk.getZ() * 16);
|
final Location pos1 = new Location(location.getWorld(), chunk.getX() * 16, 0, chunk.getZ() * 16);
|
||||||
|
@ -34,7 +34,7 @@ public class PatternTraverser {
|
|||||||
Field field = current.getDeclaredField("extent");
|
Field field = current.getDeclaredField("extent");
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
field.set(pattern, newExtent);
|
field.set(pattern, newExtent);
|
||||||
} catch (NoSuchFieldException | IllegalAccessException ignore) {
|
} catch (NoSuchFieldException | IllegalAccessException | ClassCastException ignore) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -42,7 +42,7 @@ public class PatternTraverser {
|
|||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
Object next = field.get(pattern);
|
Object next = field.get(pattern);
|
||||||
reset(next, newExtent);
|
reset(next, newExtent);
|
||||||
} catch (NoSuchFieldException | IllegalAccessException ignore) {
|
} catch (NoSuchFieldException | IllegalAccessException | ClassCastException ignore) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Field field = current.getDeclaredField("mask");
|
Field field = current.getDeclaredField("mask");
|
||||||
@ -56,7 +56,7 @@ public class PatternTraverser {
|
|||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
Pattern next = (Pattern) field.get(pattern);
|
Pattern next = (Pattern) field.get(pattern);
|
||||||
reset(next, newExtent);
|
reset(next, newExtent);
|
||||||
} catch (NoSuchFieldException | IllegalAccessException ignore) {
|
} catch (NoSuchFieldException | IllegalAccessException | ClassCastException ignore) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Field field = current.getDeclaredField("patterns");
|
Field field = current.getDeclaredField("patterns");
|
||||||
@ -65,7 +65,7 @@ public class PatternTraverser {
|
|||||||
for (Pattern next : patterns) {
|
for (Pattern next : patterns) {
|
||||||
reset(next, newExtent);
|
reset(next, newExtent);
|
||||||
}
|
}
|
||||||
} catch (NoSuchFieldException | IllegalAccessException ignore) {
|
} catch (NoSuchFieldException | IllegalAccessException | ClassCastException ignore) {
|
||||||
}
|
}
|
||||||
current = current.getSuperclass();
|
current = current.getSuperclass();
|
||||||
}
|
}
|
||||||
|
@ -1014,6 +1014,7 @@ public enum BlockTypes implements BlockType {
|
|||||||
int size = blockMap.size();
|
int size = blockMap.size();
|
||||||
for (BlockTypes type : oldValues) {
|
for (BlockTypes type : oldValues) {
|
||||||
if (!blockMap.containsKey(type.getId())) {
|
if (!blockMap.containsKey(type.getId())) {
|
||||||
|
type.init(type.getId(), 0, new ArrayList<>());
|
||||||
Fawe.debug("Invalid block registered " + type.getId());
|
Fawe.debug("Invalid block registered " + type.getId());
|
||||||
size++;
|
size++;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren