revert shop to names, next up mysql

This commit is contained in:
ZeroEpoch1969 2020-04-29 16:29:43 -07:00
parent a2a4a8a0b8
commit abbadb55ee
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
20 changed files with 169 additions and 172 deletions

View File

@ -61,76 +61,6 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib:4.5.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib:4.5.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: cglib:cglib-nodep:3.2.5" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.executors:BukkitExecutors:1.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.executors:BukkitExecutors:1.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldguard-bukkit:7.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:EssentialsX:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.papermc:paperlib:1.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:NMSProvider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:UpdatedMetaProvider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:1_8_R1Provider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:1_8_R2Provider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:LegacyProvider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:ReflectionProvider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:FlattenedProvider:2.16.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.dv8tion:JDA:4.0.0_39" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:16.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.neovisionaries:nv-websocket-client:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.13.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: club.minnced:opus-java-api:1.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.dev.jna:jna:4.4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: club.minnced:opus-java-natives:1.0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.coreprotect:coreprotect:2.16.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:core:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: rhino:js:1.7R2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:bukkit:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-bukkit:7.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-core:7.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard.worldguard-libs:core:7.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.flywaydb:flyway-core:3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q:commandbook:2.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.destroystokyo.paper:paper-api:1.15.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:21.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.13-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm:7.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-commons:7.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-tree:7.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-analysis:7.1" level="project" />
<orderEntry type="library" name="Maven: me.rayzr522:jsonmessage:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.vexsoftware:votifier:v1.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.ConnorLinfoot:ActionBarAPI:5b2d642d3d" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.9" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.15-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.12-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-LibsDisguises:11aea9b3cd" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.protocol:ProtocolLib:4.5.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: cglib:cglib-nodep:3.2.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.comphenix.executors:BukkitExecutors:1.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.1.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.1.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-core:7.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:core:7.1.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit.worldedit-libs:core:7.1.0" level="project" />
@ -228,5 +158,8 @@
<orderEntry type="library" name="Maven: me.rayzr522:jsonmessage:1.0.0" level="project" /> <orderEntry type="library" name="Maven: me.rayzr522:jsonmessage:1.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.vexsoftware:votifier:v1.9" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.vexsoftware:votifier:v1.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.ConnorLinfoot:ActionBarAPI:5b2d642d3d" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.ConnorLinfoot:ActionBarAPI:5b2d642d3d" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.goldtreeservers:worldguardextraflags:4.0.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.boydti:fawe-api:17.07.12-6b6f285-750-13.7.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13-SNAPSHOT" level="project" />
</component> </component>
</module> </module>

View File

@ -225,6 +225,13 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>net.goldtreeservers</groupId>
<artifactId>worldguardextraflags</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -159,7 +159,7 @@ public class ChatManager extends FreedomService
// Send to discord // Send to discord
if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist()) if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist())
{ {
plugin.dc.messageChatChannel(player.getName() + " \u00BB " + ChatColor.stripColor(message)); plugin.dc.messageChatChannel(plugin.dc.deformat(player.getName()) + " \u00BB " + ChatColor.stripColor(message));
} }
} }

View File

@ -39,7 +39,7 @@ import me.totalfreedom.totalfreedommod.fun.Trailer;
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon; import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder; import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilderList; import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilderList;
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilderWorldRestrictions; import me.totalfreedom.totalfreedommod.world.WorldRestrictions;
import me.totalfreedom.totalfreedommod.permissions.PermissionConfig; import me.totalfreedom.totalfreedommod.permissions.PermissionConfig;
import me.totalfreedom.totalfreedommod.permissions.PermissionManager; import me.totalfreedom.totalfreedommod.permissions.PermissionManager;
import me.totalfreedom.totalfreedommod.player.PlayerList; import me.totalfreedom.totalfreedommod.player.PlayerList;
@ -127,7 +127,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
public Trailer tr; public Trailer tr;
public HTTPDaemon hd; public HTTPDaemon hd;
public MasterBuilderList mbl; public MasterBuilderList mbl;
public MasterBuilderWorldRestrictions mbwr; public WorldRestrictions wr;
public SignBlocker snp; public SignBlocker snp;
public PlayerVerification pv; public PlayerVerification pv;
public EntityWiper ew; public EntityWiper ew;
@ -207,8 +207,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
nu = services.registerService(AntiNuke.class); nu = services.registerService(AntiNuke.class);
as = services.registerService(AntiSpam.class); as = services.registerService(AntiSpam.class);
mbl = services.registerService(MasterBuilderList.class); mbl = services.registerService(MasterBuilderList.class);
mbwr = services.registerService(MasterBuilderWorldRestrictions.class); wr = services.registerService(WorldRestrictions.class);
//hwr = services.registerService(HubWorldRestrictions.class);
pl = services.registerService(PlayerList.class); pl = services.registerService(PlayerList.class);
sh = services.registerService(Shop.class); sh = services.registerService(Shop.class);
an = services.registerService(Announcer.class); an = services.registerService(Announcer.class);

View File

@ -204,6 +204,7 @@ public class BanManager extends FreedomService
saveAll(); saveAll();
return true; return true;
} }
updateViews();
return false; return false;
} }
@ -215,6 +216,7 @@ public class BanManager extends FreedomService
saveAll(); saveAll();
return true; return true;
} }
updateViews();
return false; return false;
} }
@ -231,7 +233,7 @@ public class BanManager extends FreedomService
return size; return size;
} }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerLogin(PlayerLoginEvent event) public void onPlayerLogin(PlayerLoginEvent event)
{ {
final String username = event.getPlayer().getName(); final String username = event.getPlayer().getName();
@ -250,7 +252,7 @@ public class BanManager extends FreedomService
} }
} }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerJoin(PlayerJoinEvent event) public void onPlayerJoin(PlayerJoinEvent event)
{ {
final Player player = event.getPlayer(); final Player player = event.getPlayer();

View File

@ -161,6 +161,13 @@ public class InteractBlocker extends FreedomService
event.setCancelled(true); event.setCancelled(true);
break; break;
} }
case WRITTEN_BOOK:
{
player.getInventory().clear(player.getInventory().getHeldItemSlot());
player.sendMessage(ChatColor.GRAY + "Books are currently disabled.");
event.setCancelled(true);
break;
}
} }
} }
} }

View File

@ -22,6 +22,8 @@ public class WorldGuardBridge extends FreedomService
@Override @Override
protected void onStart() protected void onStart()
{ {
plugin.wr.protectWorld(plugin.wm.hubworld.getWorld());
plugin.wr.protectWorld(plugin.wm.masterBuilderWorld.getWorld());
} }
@Override @Override

View File

@ -127,6 +127,7 @@ public class Command_ban extends FreedomCommand
for (String ip : ips) for (String ip : ips)
{ {
ban.addIp(ip); ban.addIp(ip);
ban.addIp(FUtil.getFuzzyIp(ip));
} }
plugin.bm.addBan(ban); plugin.bm.addBan(ban);

View File

@ -24,8 +24,8 @@ public class Command_consolesay extends FreedomCommand
} }
String message = StringUtils.join(args, " "); String message = StringUtils.join(args, " ");
FUtil.bcastMsg(String.format("§7[CONSOLE] §c%s §8» §f%s", sender.getName(), StringUtils.join(args, " "))); FUtil.bcastMsg(String.format("§7[CONSOLE] §c%s §8\u00BB §f%s", sender.getName(), StringUtils.join(args, " ")));
plugin.dc.messageChatChannel("[CONSOLE] " + sender.getName() + " \u00BB " + ChatColor.stripColor(message)); plugin.dc.messageChatChannel("[CONSOLE] " + plugin.dc.deformat(sender.getName()) + " \u00BB " + ChatColor.stripColor(message));
return true; return true;
} }
} }

View File

@ -33,6 +33,7 @@ public class Command_makeopregion extends FreedomCommand
put(Flags.DESTROY_VEHICLE, StateFlag.State.ALLOW); put(Flags.DESTROY_VEHICLE, StateFlag.State.ALLOW);
put(Flags.ENTITY_ITEM_FRAME_DESTROY, StateFlag.State.ALLOW); put(Flags.ENTITY_ITEM_FRAME_DESTROY, StateFlag.State.ALLOW);
put(Flags.ENTITY_PAINTING_DESTROY, StateFlag.State.ALLOW); put(Flags.ENTITY_PAINTING_DESTROY, StateFlag.State.ALLOW);
put(net.goldtreeservers.worldguardextraflags.flags.Flags.WORLDEDIT, StateFlag.State.ALLOW);
}}; }};
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)

View File

@ -41,7 +41,7 @@ public class Command_say extends FreedomCommand
} }
FUtil.bcastMsg(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE); FUtil.bcastMsg(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
plugin.dc.messageChatChannel(String.format("[Server:%s] \u00BB %s", sender.getName(), message)); plugin.dc.messageChatChannel(String.format("[Server:%s] \u00BB %s", plugin.dc.deformat(sender.getName()), message));
return true; return true;
} }

View File

@ -7,7 +7,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME) @CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Set your compass to the specified position.", usage = "/<command> <x> <y> <z>") @CommandParameters(description = "Set your compass to the specified position.", usage = "/<command> <x> <y> <z>")
public class Command_setcompass extends FreedomCommand public class Command_setcompass extends FreedomCommand
{ {

View File

@ -180,7 +180,7 @@ public class Command_tag extends FreedomCommand
plugin.pl.getPlayer(playerSender).setTag(outputTag); plugin.pl.getPlayer(playerSender).setTag(outputTag);
if (save) if (save)
{ {
save(playerSender, outputTag); save(playerSender, strippedTag);
} }
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : "")); msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : ""));

View File

@ -44,12 +44,7 @@ public class Command_vanish extends FreedomCommand
} }
if (!silent) if (!silent)
{ {
String beginning = sender.getName() + " is "; FUtil.bcastMsg(plugin.rm.craftLoginMessage(playerSender, null));
if (admin.getLoginMessage().contains("%name%"))
{
beginning = "";
}
FUtil.bcastMsg(ChatColor.AQUA + beginning + loginMsg);
FUtil.bcastMsg(playerSender.getName() + " joined the game.", ChatColor.YELLOW); FUtil.bcastMsg(playerSender.getName() + " joined the game.", ChatColor.YELLOW);
plugin.dc.messageChatChannel("**" + playerSender.getName() + " joined the server" + "**"); plugin.dc.messageChatChannel("**" + playerSender.getName() + " joined the server" + "**");
} }

View File

@ -331,13 +331,13 @@ public class Discord extends FreedomService
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event) public void onPlayerJoin(PlayerJoinEvent event)
{ {
messageChatChannel("**" + event.getPlayer().getName() + " joined the server" + "**"); messageChatChannel("**" + deformat(event.getPlayer().getName()) + " joined the server" + "**");
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onPlayerLeave(PlayerQuitEvent event) public void onPlayerLeave(PlayerQuitEvent event)
{ {
messageChatChannel("**" + event.getPlayer().getName() + " left the server" + "**"); messageChatChannel("**" + deformat(event.getPlayer().getName()) + " left the server" + "**");
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -354,7 +354,7 @@ public class Discord extends FreedomService
{ {
} }
messageChatChannel("**" + event.getDeathMessage() + "**"); messageChatChannel("**" + deformat(event.getDeathMessage()) + "**");
} }
@Override @Override
@ -430,6 +430,11 @@ public class Discord extends FreedomService
FLog.info("Discord verification bot has successfully shutdown."); FLog.info("Discord verification bot has successfully shutdown.");
} }
public String deformat(String input)
{
return input.replace("_", "\\_");
}
public boolean sendReport(Player reporter, Player reported, String reason) public boolean sendReport(Player reporter, Player reported, String reason)
{ {
if (ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString().isEmpty()) if (ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString().isEmpty())

View File

@ -189,17 +189,7 @@ public class ItemFun extends FreedomService
case CARROT: case CARROT:
{ {
if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean() || !plugin.al.isSeniorAdmin(player) || plugin.wr.doRestrict(player))
{
break;
}
if (!plugin.al.isSeniorAdmin(player))
{
break;
}
if (player.getWorld().equals(plugin.wm.masterBuilderWorld.getWorld()) && plugin.mbwr.doRestrict(player))
{ {
break; break;
} }

View File

@ -16,6 +16,7 @@ import me.rayzr522.jsonmessage.JSONMessage;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import net.pravian.aero.config.YamlConfig; import net.pravian.aero.config.YamlConfig;
@ -37,7 +38,7 @@ import org.bukkit.scheduler.BukkitTask;
public class Shop extends FreedomService public class Shop extends FreedomService
{ {
@Getter @Getter
public final Map<UUID, ShopData> dataMap = Maps.newHashMap(); public final Map<String, ShopData> dataMap = Maps.newHashMap();
@Getter @Getter
private final File configFolder; private final File configFolder;
private BukkitTask reactions; private BukkitTask reactions;
@ -102,8 +103,8 @@ public class Shop extends FreedomService
YamlConfig config = getConfig(data); YamlConfig config = getConfig(data);
data.saveTo(config); data.saveTo(config);
config.save(); config.save();
dataMap.remove(data.getUUID()); dataMap.remove(data.getUsername());
dataMap.put(data.getUUID(), data); dataMap.put(data.getUsername(), data);
} }
public String getShopPrefix() public String getShopPrefix()
@ -119,30 +120,29 @@ public class Shop extends FreedomService
// May not return null // May not return null
public ShopData getData(Player player) public ShopData getData(Player player)
{ {
// Check already loaded // Check for existing data
ShopData data = dataMap.get(player.getUniqueId()); ShopData data = dataMap.get(player.getName());
if (data != null) if (data != null)
{ {
return data; return data;
} }
// Load data // Load data
data = getData(player.getUniqueId()); data = getData(player.getName());
// Create data if nonexistent String ip = Ips.getIp(player);
// Create new data if nonexistent
if (data == null) if (data == null)
{ {
FLog.info("Creating new shop data entry for " + player.getName()); FLog.info("Creating new player verification entry for " + player.getName());
// Create new player // Create new player
data = new ShopData(player); data = new ShopData(player);
data.setUsername(player.getName()); data.addIp(Ips.getIp(player));
// Set defaults
data.setCoins(0);
// Store player // Store player
dataMap.put(player.getUniqueId(), data); dataMap.put(player.getName(), data);
// Save player // Save player
YamlConfig config = getConfig(data); YamlConfig config = getConfig(data);
@ -150,34 +150,46 @@ public class Shop extends FreedomService
config.save(); config.save();
} }
dataMap.put(player.getUniqueId(), data); if (!data.getsIps().contains(ip))
{
data.addIp(ip);
save(data);
}
return data; return data;
} }
public ShopData getData(String username) public ShopData getData(String username)
{ {
UUID uuid = FUtil.nameToUUID(username); username = username.toLowerCase();
if (uuid != null)
{
return getData(uuid);
}
return null;
}
public ShopData getData(UUID uuid) final File configFile = getConfigFile(username);
{
// Check if the player is a known player
final File configFile = getConfigFile(uuid);
if (!configFile.exists()) if (!configFile.exists())
{ {
return null; return null;
} }
// Load entry final ShopData shopData = new ShopData(username);
final ShopData data = new ShopData(uuid); shopData.loadFrom(getConfig(shopData));
data.loadFrom(getConfig(data));
return data; if (!shopData.isValid())
{
FLog.warning("Could not load player verification entry for " + username + ". Entry is not valid!");
configFile.delete();
return null;
}
// Only store data in map if the player is online
for (Player players : server.getOnlinePlayers())
{
if (players.getName().equals(username))
{
dataMap.put(username, shopData);
return shopData;
}
}
return shopData;
} }
public Inventory generateShopGUI(ShopData shopData) public Inventory generateShopGUI(ShopData shopData)
@ -329,7 +341,7 @@ public class Shop extends FreedomService
} }
Player player = (Player) event.getWhoClicked(); Player player = (Player) event.getWhoClicked();
ShopData shopData = plugin.sh.getData(player); ShopData shopData = getData(player);
int price = shopItem.getCost(); int price = shopItem.getCost();
int coins = shopData.getCoins(); int coins = shopData.getCoins();
@ -420,14 +432,14 @@ public class Shop extends FreedomService
return dataMap.values(); return dataMap.values();
} }
protected File getConfigFile(UUID uuid) protected File getConfigFile(String name)
{ {
return new File(getConfigFolder(), uuid + ".yml"); return new File(getConfigFolder(), name.toLowerCase() + ".yml");
} }
protected YamlConfig getConfig(ShopData data) protected YamlConfig getConfig(ShopData data)
{ {
final YamlConfig config = new YamlConfig(plugin, getConfigFile(data.getUUID()), false); final YamlConfig config = new YamlConfig(plugin, getConfigFile(data.getUsername()), false);
config.load(); config.load();
return config; return config;
} }

View File

@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
public class ShopData implements ConfigLoadable, ConfigSavable, Validatable public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
{ {
private final List<String> ips = Lists.newArrayList();
@Getter @Getter
@Setter @Setter
private String username; private String username;
@ -30,19 +31,19 @@ public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
public ShopData(Player player) public ShopData(Player player)
{ {
this(player.getUniqueId()); this(player.getName());
} }
public ShopData(UUID uuid) public ShopData(String name)
{ {
this.uuid = uuid.toString(); this.username = name;
} }
@Override @Override
public void loadFrom(ConfigurationSection cs) public void loadFrom(ConfigurationSection cs)
{ {
this.username = cs.getString("username", username); this.username = cs.getString("username", username);
this.uuid = cs.getString("uuid", uuid); this.ips.addAll(cs.getStringList("ips"));
this.coins = cs.getInt("coins", coins); this.coins = cs.getInt("coins", coins);
this.items.addAll(cs.getStringList("items")); this.items.addAll(cs.getStringList("items"));
this.totalVotes = cs.getInt("totalVotes"); this.totalVotes = cs.getInt("totalVotes");
@ -53,7 +54,7 @@ public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
{ {
Validate.isTrue(isValid(), "Could not save shop entry: " + username + ". Entry not valid!"); Validate.isTrue(isValid(), "Could not save shop entry: " + username + ". Entry not valid!");
cs.set("username", username); cs.set("username", username);
cs.set("uuid", uuid); cs.set("ips", ips);
cs.set("coins", coins); cs.set("coins", coins);
cs.set("items", items); cs.set("items", items);
cs.set("totalVotes", totalVotes); cs.set("totalVotes", totalVotes);
@ -64,16 +65,6 @@ public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
return Collections.unmodifiableList(items); return Collections.unmodifiableList(items);
} }
public void setUUID(UUID id)
{
uuid = id.toString();
}
public UUID getUUID()
{
return UUID.fromString(uuid);
}
public void giveItem(ShopItem item) public void giveItem(ShopItem item)
{ {
items.add(item.getDataName()); items.add(item.getDataName());
@ -88,6 +79,21 @@ public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
return false; return false;
} }
public boolean addIp(String ip)
{
return !ips.contains(ip) && ips.add(ip);
}
public void removeIp(String ip)
{
ips.remove(ip);
}
public List<String> getsIps()
{
return Collections.unmodifiableList(ips);
}
public void removeItem(ShopItem item) public void removeItem(ShopItem item)
{ {
items.remove(item.getDataName()); items.remove(item.getDataName());

View File

@ -9,7 +9,6 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -25,7 +24,7 @@ public class WorldManager extends FreedomService
public Flatlands flatlands; public Flatlands flatlands;
public AdminWorld adminworld; public AdminWorld adminworld;
public MasterBuilderWorld masterBuilderWorld; public MasterBuilderWorld masterBuilderWorld;
//public HubWorld hubworld; public HubWorld hubworld;
public WorldManager(TotalFreedomMod plugin) public WorldManager(TotalFreedomMod plugin)
{ {
@ -34,7 +33,7 @@ public class WorldManager extends FreedomService
this.flatlands = new Flatlands(); this.flatlands = new Flatlands();
this.adminworld = new AdminWorld(); this.adminworld = new AdminWorld();
this.masterBuilderWorld = new MasterBuilderWorld(); this.masterBuilderWorld = new MasterBuilderWorld();
//this.hubworld = new HubWorld(); this.hubworld = new HubWorld();
} }
@Override @Override
@ -43,7 +42,8 @@ public class WorldManager extends FreedomService
flatlands.getWorld(); flatlands.getWorld();
adminworld.getWorld(); adminworld.getWorld();
masterBuilderWorld.getWorld(); masterBuilderWorld.getWorld();
//hubworld.getWorld(); hubworld.getWorld();
// Disable weather // Disable weather
if (ConfigEntry.DISABLE_WEATHER.getBoolean()) if (ConfigEntry.DISABLE_WEATHER.getBoolean())
{ {
@ -63,7 +63,7 @@ public class WorldManager extends FreedomService
flatlands.getWorld().save(); flatlands.getWorld().save();
adminworld.getWorld().save(); adminworld.getWorld().save();
masterBuilderWorld.getWorld().save(); masterBuilderWorld.getWorld().save();
//hubworld.getWorld().save(); hubworld.getWorld().save();
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
@ -113,10 +113,10 @@ public class WorldManager extends FreedomService
{ {
return; return;
} }
/*else if (event.getWorld().equals(hubworld.getWorld()) && hubworld.getWeatherMode() != WorldWeather.OFF) else if (event.getWorld().equals(hubworld.getWorld()) && hubworld.getWeatherMode() != WorldWeather.OFF)
{ {
return; return;
}*/ }
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -141,10 +141,10 @@ public class WorldManager extends FreedomService
{ {
return; return;
} }
/*else if (event.getWorld().equals(hubworld.getWorld()) && hubworld.getWeatherMode() != WorldWeather.OFF) else if (event.getWorld().equals(hubworld.getWorld()) && hubworld.getWeatherMode() != WorldWeather.OFF)
{ {
return; return;
}*/ }
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -1,11 +1,19 @@
package me.totalfreedom.totalfreedommod.masterbuilder; package me.totalfreedom.totalfreedommod.world;
import com.sk89q.worldguard.protection.flags.Flag;
import com.sk89q.worldguard.protection.flags.Flags;
import com.sk89q.worldguard.protection.flags.StateFlag;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -16,13 +24,25 @@ import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
public class MasterBuilderWorldRestrictions extends FreedomService public class WorldRestrictions extends FreedomService
{ {
public final List<String> BLOCKED_WORLDEDIT_COMMANDS = Arrays.asList( private final List<String> BLOCKED_WORLDEDIT_COMMANDS = Arrays.asList(
"green", "fixlava", "fixwater", "br", "brush", "tool", "mat", "range", "cs", "up", "fill", "setblock", "tree", "replacenear"); "green", "fixlava", "fixwater", "br", "brush", "tool", "mat", "range", "cs", "up", "fill", "setblock", "tree", "replacenear");
public MasterBuilderWorldRestrictions(TotalFreedomMod plugin) private final Map<Flag<?>, Object> flags = new HashMap<Flag<?>, Object>()
{{
put(Flags.BLOCK_PLACE, StateFlag.State.DENY);
put(Flags.BLOCK_BREAK, StateFlag.State.DENY);
put(Flags.BUILD, StateFlag.State.DENY);
put(Flags.PLACE_VEHICLE, StateFlag.State.DENY);
put(Flags.DESTROY_VEHICLE, StateFlag.State.DENY);
put(Flags.ENTITY_ITEM_FRAME_DESTROY, StateFlag.State.DENY);
put(Flags.ENTITY_PAINTING_DESTROY, StateFlag.State.DENY);
put(net.goldtreeservers.worldguardextraflags.flags.Flags.WORLDEDIT, StateFlag.State.DENY);
}};
public WorldRestrictions(TotalFreedomMod plugin)
{ {
super(plugin); super(plugin);
} }
@ -39,10 +59,13 @@ public class MasterBuilderWorldRestrictions extends FreedomService
public boolean doRestrict(Player player) public boolean doRestrict(Player player)
{ {
if (!plugin.mbl.isMasterBuilder(player) && !FUtil.canManageMasterBuilders(player.getName()) && player.getWorld().equals(plugin.wm.masterBuilderWorld.getWorld())) if (!plugin.mbl.isMasterBuilder(player) && !FUtil.canManageMasterBuilders(player.getName()))
{
if (player.getWorld().equals(plugin.wm.masterBuilderWorld.getWorld()) || player.getWorld().equals(plugin.wm.hubworld.getWorld()))
{ {
return true; return true;
} }
}
return false; return false;
} }
@ -117,18 +140,32 @@ public class MasterBuilderWorldRestrictions extends FreedomService
if (command.startsWith("/") || BLOCKED_WORLDEDIT_COMMANDS.contains(command)) if (command.startsWith("/") || BLOCKED_WORLDEDIT_COMMANDS.contains(command))
{ {
player.sendMessage(ChatColor.RED + "Only Master Builders are allowed to use WorldEdit in the Master Builder world."); player.sendMessage(ChatColor.RED + "Only Master Builders are allowed to use WorldEdit here.");
event.setCancelled(true); event.setCancelled(true);
} }
if (!plugin.al.isSeniorAdmin(player)) if (command.equals("coreprotect") || command.equals("core") || command.equals("co"))
{ {
if (command.equals("coreprotect") || command.equals("co")) player.sendMessage(ChatColor.RED + "Only Master Builders are allowed to use CoreProtect here.");
{
player.sendMessage(ChatColor.RED + "Only Senior Admins are allowed to use CoreProtect in the Master Builder world.");
event.setCancelled(true); event.setCancelled(true);
} }
} }
} }
public void protectWorld(World world)
{
if (!plugin.wgb.isEnabled())
{
return;
}
RegionManager regionManager = plugin.wgb.getRegionManager(world);
ProtectedRegion region = regionManager.getRegion("__global__");
region.setFlags(flags);
regionManager.addRegion(region);
} }
} }