mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
revert shop to names, next up mysql
This commit is contained in:
parent
a2a4a8a0b8
commit
abbadb55ee
@ -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: 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: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-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" 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: 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>
|
||||
</module>
|
7
pom.xml
7
pom.xml
@ -225,6 +225,13 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.goldtreeservers</groupId>
|
||||
<artifactId>worldguardextraflags</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -159,7 +159,7 @@ public class ChatManager extends FreedomService
|
||||
// Send to discord
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ import me.totalfreedom.totalfreedommod.fun.Trailer;
|
||||
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
|
||||
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
|
||||
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.PermissionManager;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerList;
|
||||
@ -127,7 +127,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
public Trailer tr;
|
||||
public HTTPDaemon hd;
|
||||
public MasterBuilderList mbl;
|
||||
public MasterBuilderWorldRestrictions mbwr;
|
||||
public WorldRestrictions wr;
|
||||
public SignBlocker snp;
|
||||
public PlayerVerification pv;
|
||||
public EntityWiper ew;
|
||||
@ -207,8 +207,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
nu = services.registerService(AntiNuke.class);
|
||||
as = services.registerService(AntiSpam.class);
|
||||
mbl = services.registerService(MasterBuilderList.class);
|
||||
mbwr = services.registerService(MasterBuilderWorldRestrictions.class);
|
||||
//hwr = services.registerService(HubWorldRestrictions.class);
|
||||
wr = services.registerService(WorldRestrictions.class);
|
||||
pl = services.registerService(PlayerList.class);
|
||||
sh = services.registerService(Shop.class);
|
||||
an = services.registerService(Announcer.class);
|
||||
|
@ -204,6 +204,7 @@ public class BanManager extends FreedomService
|
||||
saveAll();
|
||||
return true;
|
||||
}
|
||||
updateViews();
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -215,6 +216,7 @@ public class BanManager extends FreedomService
|
||||
saveAll();
|
||||
return true;
|
||||
}
|
||||
updateViews();
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -231,7 +233,7 @@ public class BanManager extends FreedomService
|
||||
return size;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerLogin(PlayerLoginEvent event)
|
||||
{
|
||||
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)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
|
@ -161,6 +161,13 @@ public class InteractBlocker extends FreedomService
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
case WRITTEN_BOOK:
|
||||
{
|
||||
player.getInventory().clear(player.getInventory().getHeldItemSlot());
|
||||
player.sendMessage(ChatColor.GRAY + "Books are currently disabled.");
|
||||
event.setCancelled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ public class WorldGuardBridge extends FreedomService
|
||||
@Override
|
||||
protected void onStart()
|
||||
{
|
||||
plugin.wr.protectWorld(plugin.wm.hubworld.getWorld());
|
||||
plugin.wr.protectWorld(plugin.wm.masterBuilderWorld.getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,6 +127,7 @@ public class Command_ban extends FreedomCommand
|
||||
for (String ip : ips)
|
||||
{
|
||||
ban.addIp(ip);
|
||||
ban.addIp(FUtil.getFuzzyIp(ip));
|
||||
}
|
||||
plugin.bm.addBan(ban);
|
||||
|
||||
|
@ -24,8 +24,8 @@ public class Command_consolesay extends FreedomCommand
|
||||
}
|
||||
|
||||
String message = StringUtils.join(args, " ");
|
||||
FUtil.bcastMsg(String.format("§7[CONSOLE] §c%s §8» §f%s", sender.getName(), StringUtils.join(args, " ")));
|
||||
plugin.dc.messageChatChannel("[CONSOLE] " + sender.getName() + " \u00BB " + ChatColor.stripColor(message));
|
||||
FUtil.bcastMsg(String.format("§7[CONSOLE] §c%s §8\u00BB §f%s", sender.getName(), StringUtils.join(args, " ")));
|
||||
plugin.dc.messageChatChannel("[CONSOLE] " + plugin.dc.deformat(sender.getName()) + " \u00BB " + ChatColor.stripColor(message));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public class Command_makeopregion extends FreedomCommand
|
||||
put(Flags.DESTROY_VEHICLE, StateFlag.State.ALLOW);
|
||||
put(Flags.ENTITY_ITEM_FRAME_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)
|
||||
|
@ -41,7 +41,7 @@ public class Command_say extends FreedomCommand
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
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>")
|
||||
public class Command_setcompass extends FreedomCommand
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ public class Command_tag extends FreedomCommand
|
||||
plugin.pl.getPlayer(playerSender).setTag(outputTag);
|
||||
if (save)
|
||||
{
|
||||
save(playerSender, outputTag);
|
||||
save(playerSender, strippedTag);
|
||||
}
|
||||
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : ""));
|
||||
|
||||
|
@ -44,12 +44,7 @@ public class Command_vanish extends FreedomCommand
|
||||
}
|
||||
if (!silent)
|
||||
{
|
||||
String beginning = sender.getName() + " is ";
|
||||
if (admin.getLoginMessage().contains("%name%"))
|
||||
{
|
||||
beginning = "";
|
||||
}
|
||||
FUtil.bcastMsg(ChatColor.AQUA + beginning + loginMsg);
|
||||
FUtil.bcastMsg(plugin.rm.craftLoginMessage(playerSender, null));
|
||||
FUtil.bcastMsg(playerSender.getName() + " joined the game.", ChatColor.YELLOW);
|
||||
plugin.dc.messageChatChannel("**" + playerSender.getName() + " joined the server" + "**");
|
||||
}
|
||||
|
@ -331,13 +331,13 @@ public class Discord extends FreedomService
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
messageChatChannel("**" + event.getPlayer().getName() + " joined the server" + "**");
|
||||
messageChatChannel("**" + deformat(event.getPlayer().getName()) + " joined the server" + "**");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerLeave(PlayerQuitEvent event)
|
||||
{
|
||||
messageChatChannel("**" + event.getPlayer().getName() + " left the server" + "**");
|
||||
messageChatChannel("**" + deformat(event.getPlayer().getName()) + " left the server" + "**");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@ -354,7 +354,7 @@ public class Discord extends FreedomService
|
||||
{
|
||||
}
|
||||
|
||||
messageChatChannel("**" + event.getDeathMessage() + "**");
|
||||
messageChatChannel("**" + deformat(event.getDeathMessage()) + "**");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -430,6 +430,11 @@ public class Discord extends FreedomService
|
||||
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)
|
||||
{
|
||||
if (ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString().isEmpty())
|
||||
|
@ -189,17 +189,7 @@ public class ItemFun extends FreedomService
|
||||
|
||||
case CARROT:
|
||||
{
|
||||
if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!plugin.al.isSeniorAdmin(player))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (player.getWorld().equals(plugin.wm.masterBuilderWorld.getWorld()) && plugin.mbwr.doRestrict(player))
|
||||
if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean() || !plugin.al.isSeniorAdmin(player) || plugin.wr.doRestrict(player))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import me.rayzr522.jsonmessage.JSONMessage;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.config.YamlConfig;
|
||||
@ -37,7 +38,7 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
public class Shop extends FreedomService
|
||||
{
|
||||
@Getter
|
||||
public final Map<UUID, ShopData> dataMap = Maps.newHashMap();
|
||||
public final Map<String, ShopData> dataMap = Maps.newHashMap();
|
||||
@Getter
|
||||
private final File configFolder;
|
||||
private BukkitTask reactions;
|
||||
@ -102,8 +103,8 @@ public class Shop extends FreedomService
|
||||
YamlConfig config = getConfig(data);
|
||||
data.saveTo(config);
|
||||
config.save();
|
||||
dataMap.remove(data.getUUID());
|
||||
dataMap.put(data.getUUID(), data);
|
||||
dataMap.remove(data.getUsername());
|
||||
dataMap.put(data.getUsername(), data);
|
||||
}
|
||||
|
||||
public String getShopPrefix()
|
||||
@ -119,30 +120,29 @@ public class Shop extends FreedomService
|
||||
// May not return null
|
||||
public ShopData getData(Player player)
|
||||
{
|
||||
// Check already loaded
|
||||
ShopData data = dataMap.get(player.getUniqueId());
|
||||
// Check for existing data
|
||||
ShopData data = dataMap.get(player.getName());
|
||||
if (data != null)
|
||||
{
|
||||
return 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)
|
||||
{
|
||||
FLog.info("Creating new shop data entry for " + player.getName());
|
||||
FLog.info("Creating new player verification entry for " + player.getName());
|
||||
|
||||
// Create new player
|
||||
data = new ShopData(player);
|
||||
data.setUsername(player.getName());
|
||||
|
||||
// Set defaults
|
||||
data.setCoins(0);
|
||||
data.addIp(Ips.getIp(player));
|
||||
|
||||
// Store player
|
||||
dataMap.put(player.getUniqueId(), data);
|
||||
dataMap.put(player.getName(), data);
|
||||
|
||||
// Save player
|
||||
YamlConfig config = getConfig(data);
|
||||
@ -150,34 +150,46 @@ public class Shop extends FreedomService
|
||||
config.save();
|
||||
}
|
||||
|
||||
dataMap.put(player.getUniqueId(), data);
|
||||
if (!data.getsIps().contains(ip))
|
||||
{
|
||||
data.addIp(ip);
|
||||
save(data);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public ShopData getData(String username)
|
||||
{
|
||||
UUID uuid = FUtil.nameToUUID(username);
|
||||
if (uuid != null)
|
||||
{
|
||||
return getData(uuid);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
username = username.toLowerCase();
|
||||
|
||||
public ShopData getData(UUID uuid)
|
||||
{
|
||||
// Check if the player is a known player
|
||||
final File configFile = getConfigFile(uuid);
|
||||
final File configFile = getConfigFile(username);
|
||||
if (!configFile.exists())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Load entry
|
||||
final ShopData data = new ShopData(uuid);
|
||||
data.loadFrom(getConfig(data));
|
||||
return data;
|
||||
final ShopData shopData = new ShopData(username);
|
||||
shopData.loadFrom(getConfig(shopData));
|
||||
|
||||
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)
|
||||
@ -329,7 +341,7 @@ public class Shop extends FreedomService
|
||||
}
|
||||
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
ShopData shopData = plugin.sh.getData(player);
|
||||
ShopData shopData = getData(player);
|
||||
int price = shopItem.getCost();
|
||||
int coins = shopData.getCoins();
|
||||
|
||||
@ -420,14 +432,14 @@ public class Shop extends FreedomService
|
||||
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)
|
||||
{
|
||||
final YamlConfig config = new YamlConfig(plugin, getConfigFile(data.getUUID()), false);
|
||||
final YamlConfig config = new YamlConfig(plugin, getConfigFile(data.getUsername()), false);
|
||||
config.load();
|
||||
return config;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
|
||||
public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
|
||||
{
|
||||
|
||||
private final List<String> ips = Lists.newArrayList();
|
||||
@Getter
|
||||
@Setter
|
||||
private String username;
|
||||
@ -30,19 +31,19 @@ public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
|
||||
|
||||
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
|
||||
public void loadFrom(ConfigurationSection cs)
|
||||
{
|
||||
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.items.addAll(cs.getStringList("items"));
|
||||
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!");
|
||||
cs.set("username", username);
|
||||
cs.set("uuid", uuid);
|
||||
cs.set("ips", ips);
|
||||
cs.set("coins", coins);
|
||||
cs.set("items", items);
|
||||
cs.set("totalVotes", totalVotes);
|
||||
@ -64,16 +65,6 @@ public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
|
||||
return Collections.unmodifiableList(items);
|
||||
}
|
||||
|
||||
public void setUUID(UUID id)
|
||||
{
|
||||
uuid = id.toString();
|
||||
}
|
||||
|
||||
public UUID getUUID()
|
||||
{
|
||||
return UUID.fromString(uuid);
|
||||
}
|
||||
|
||||
public void giveItem(ShopItem item)
|
||||
{
|
||||
items.add(item.getDataName());
|
||||
@ -88,6 +79,21 @@ public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
|
||||
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)
|
||||
{
|
||||
items.remove(item.getDataName());
|
||||
|
@ -9,7 +9,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -25,7 +24,7 @@ public class WorldManager extends FreedomService
|
||||
public Flatlands flatlands;
|
||||
public AdminWorld adminworld;
|
||||
public MasterBuilderWorld masterBuilderWorld;
|
||||
//public HubWorld hubworld;
|
||||
public HubWorld hubworld;
|
||||
|
||||
public WorldManager(TotalFreedomMod plugin)
|
||||
{
|
||||
@ -34,7 +33,7 @@ public class WorldManager extends FreedomService
|
||||
this.flatlands = new Flatlands();
|
||||
this.adminworld = new AdminWorld();
|
||||
this.masterBuilderWorld = new MasterBuilderWorld();
|
||||
//this.hubworld = new HubWorld();
|
||||
this.hubworld = new HubWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,7 +42,8 @@ public class WorldManager extends FreedomService
|
||||
flatlands.getWorld();
|
||||
adminworld.getWorld();
|
||||
masterBuilderWorld.getWorld();
|
||||
//hubworld.getWorld();
|
||||
hubworld.getWorld();
|
||||
|
||||
// Disable weather
|
||||
if (ConfigEntry.DISABLE_WEATHER.getBoolean())
|
||||
{
|
||||
@ -63,7 +63,7 @@ public class WorldManager extends FreedomService
|
||||
flatlands.getWorld().save();
|
||||
adminworld.getWorld().save();
|
||||
masterBuilderWorld.getWorld().save();
|
||||
//hubworld.getWorld().save();
|
||||
hubworld.getWorld().save();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
@ -113,10 +113,10 @@ public class WorldManager extends FreedomService
|
||||
{
|
||||
return;
|
||||
}
|
||||
/*else if (event.getWorld().equals(hubworld.getWorld()) && hubworld.getWeatherMode() != WorldWeather.OFF)
|
||||
else if (event.getWorld().equals(hubworld.getWorld()) && hubworld.getWeatherMode() != WorldWeather.OFF)
|
||||
{
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -141,10 +141,10 @@ public class WorldManager extends FreedomService
|
||||
{
|
||||
return;
|
||||
}
|
||||
/*else if (event.getWorld().equals(hubworld.getWorld()) && hubworld.getWeatherMode() != WorldWeather.OFF)
|
||||
else if (event.getWorld().equals(hubworld.getWorld()) && hubworld.getWeatherMode() != WorldWeather.OFF)
|
||||
{
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -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.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
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.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");
|
||||
|
||||
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);
|
||||
}
|
||||
@ -39,9 +59,12 @@ public class MasterBuilderWorldRestrictions extends FreedomService
|
||||
|
||||
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()))
|
||||
{
|
||||
return true;
|
||||
if (player.getWorld().equals(plugin.wm.masterBuilderWorld.getWorld()) || player.getWorld().equals(plugin.wm.hubworld.getWorld()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -117,18 +140,32 @@ public class MasterBuilderWorldRestrictions extends FreedomService
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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 Senior Admins are allowed to use CoreProtect in the Master Builder world.");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
player.sendMessage(ChatColor.RED + "Only Master Builders are allowed to use CoreProtect here.");
|
||||
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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user