mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Fixed plotme converter sorta
It should also technically work for offline mode server (untested)
This commit is contained in:
parent
0a61e516f3
commit
e6ed231e05
@ -61,28 +61,60 @@ public class PlotMeConverter {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
// TODO It just comes up with a NoSuchFieldException. Y U NO WORK!!! (I didn't change anything here btw)
|
// TODO It just comes up with a NoSuchFieldException. Y U NO WORK!!! (I didn't change anything here btw)
|
||||||
|
Field fAdded = plot.getClass().getDeclaredField("allowed");
|
||||||
Field fAdded = plot.getClass().getField("allowed");
|
Field fDenied = plot.getClass().getDeclaredField("denied");
|
||||||
Field fDenied = plot.getClass().getField("denied");
|
|
||||||
fAdded.setAccessible(true);
|
fAdded.setAccessible(true);
|
||||||
fDenied.setAccessible(true);
|
fDenied.setAccessible(true);
|
||||||
added = (PlayerList) fAdded.get(plot);
|
added = (PlayerList) fAdded.get(plot);
|
||||||
denied = (PlayerList) fDenied.get(plot);
|
denied = (PlayerList) fDenied.get(plot);
|
||||||
for (Map.Entry<String, UUID> set : added.getAllPlayers().entrySet()) {
|
for (Map.Entry<String, UUID> set : added.getAllPlayers().entrySet()) {
|
||||||
if (set.getKey().equalsIgnoreCase("*") || set.getValue().toString().equalsIgnoreCase("*")) {
|
if (set.getValue() != null || set.getKey().equals("*")) {
|
||||||
psAdded.add(com.intellectualcrafters.plot.database.DBFunc.everyone);
|
if (set.getKey().equalsIgnoreCase("*") || set.getValue().toString().equals("*")) {
|
||||||
continue;
|
psAdded.add(DBFunc.everyone);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Does this work for offline mode servers?
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (uuidMap.containsKey(set.getKey())) {
|
||||||
|
psAdded.add(uuidMap.get(set.getKey()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
UUID value = Bukkit.getOfflinePlayer(set.getKey()).getUniqueId();
|
||||||
|
if (value!=null) {
|
||||||
|
uuidMap.put(set.getKey(), value);
|
||||||
|
psAdded.add(value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
psAdded.add(set.getValue());
|
psAdded.add(set.getValue());
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, UUID> set : denied.getAllPlayers().entrySet()) {
|
for (Map.Entry<String, UUID> set : denied.getAllPlayers().entrySet()) {
|
||||||
if (set.getKey().equalsIgnoreCase("*") || set.getValue().toString().equalsIgnoreCase("*")) {
|
if (set.getValue() != null || set.getKey().equals("*")) {
|
||||||
psDenied.add(com.intellectualcrafters.plot.database.DBFunc.everyone);
|
if (set.getKey().equals("*") || set.getValue().toString().equals("*")) {
|
||||||
continue;
|
psDenied.add(DBFunc.everyone);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (uuidMap.containsKey(set.getKey())) {
|
||||||
|
psDenied.add(uuidMap.get(set.getKey()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
UUID value = Bukkit.getOfflinePlayer(set.getKey()).getUniqueId();
|
||||||
|
if (value!=null) {
|
||||||
|
uuidMap.put(set.getKey(), value);
|
||||||
|
psDenied.add(value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
psDenied.add(set.getValue());
|
psDenied.add(set.getValue());
|
||||||
}
|
}
|
||||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
} catch (Exception e) {
|
||||||
// Doing it the slow way like a n00b.
|
// Doing it the slow way like a n00b.
|
||||||
for (String user:plot.getAllowed().split(",")) {
|
for (String user:plot.getAllowed().split(",")) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user