mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
permission system
This commit is contained in:
parent
e23bfa7f87
commit
bc8ff3cd7f
@ -61,58 +61,7 @@
|
|||||||
<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.github.TFPatches:TF-WorldEdit:fd3f56f015" 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: com.github.TFPatches.TF-WorldEdit:ap:fd3f56f015" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:bukkit:fd3f56f015" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:core:fd3f56f015" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-bukkit:fd3f56f015" 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: org.bstats:bstats-bukkit:1.5" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches.TF-WorldEdit:worldedit-core:fd3f56f015" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: de.schlichtherle:truezip:6.8.3" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-profile-default_2.13:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.scala-lang:scala-library:2.13.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-http:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-kernel-spec:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-annotations:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.findbugs:annotations:3.0.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-cio:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-io:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-services:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-logging:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpclient:4.5.10" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpcore:4.4.12" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:jcl-over-slf4j:1.7.28" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-odf:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-zipdriver:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-zip:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bouncycastle:bcprov-jdk15on:1.63" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-tardriver:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.commons:commons-compress:1.19" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-bzip2:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-gzip:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-tar-xz:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.tukaani:xz:1.8" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-zip-raes:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-profile-base_2.13:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-access-swing:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-access:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-file:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-jar:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-driver-zip:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-comp-ibm437:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truevfs:truevfs-kernel-impl_2.13:0.12.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-console:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-default:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-swing:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-macosx:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-key-spec:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.truecommons:truecommons-shed:2.5.0" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mozilla:rhino:1.7.11" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: it.unimi.dsi:fastutil:8.2.1" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.antlr:antlr4-runtime:4.7.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: 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: 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:NMSProvider:2.16.1" level="project" />
|
||||||
@ -142,14 +91,16 @@
|
|||||||
<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-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-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: 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: 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: com.sk89q.worldedit.worldedit-libs:bukkit:7.0.0-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TFPatches:TF-WorldGuard:bb12813214" 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.github.TFPatches.TF-WorldGuard:core:bb12813214" 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.github.TFPatches.TF-WorldGuard:worldguard-bukkit:bb12813214" 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:commandbook:2.3" 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: com.github.TFPatches.TF-WorldGuard:worldguard-core:bb12813214" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.flywaydb:flyway-core:3.0" 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: 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: 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: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||||
|
19
pom.xml
19
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>me.totalfreedom</groupId>
|
<groupId>me.totalfreedom</groupId>
|
||||||
<artifactId>TotalFreedomMod</artifactId>
|
<artifactId>TotalFreedomMod</artifactId>
|
||||||
<version>5.4</version>
|
<version>5.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -49,6 +49,11 @@
|
|||||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
|
<repository>
|
||||||
|
<id>enginehub</id>
|
||||||
|
<url>https://maven.enginehub.org/repo/</url>
|
||||||
|
</repository>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>elmakers-repo</id>
|
<id>elmakers-repo</id>
|
||||||
<url>http://maven.elmakers.com/repository/</url>
|
<url>http://maven.elmakers.com/repository/</url>
|
||||||
@ -159,9 +164,9 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.TFPatches</groupId>
|
<groupId>com.sk89q.worldedit</groupId>
|
||||||
<artifactId>TF-WorldEdit</artifactId>
|
<artifactId>worldedit-bukkit</artifactId>
|
||||||
<version>fd3f56f015</version>
|
<version>7.1.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -187,9 +192,9 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.TFPatches</groupId>
|
<groupId>com.sk89q.worldguard</groupId>
|
||||||
<artifactId>TF-WorldGuard</artifactId>
|
<artifactId>worldguard-bukkit</artifactId>
|
||||||
<version>bb12813214</version>
|
<version>7.0.2</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public class LoginProcess extends FreedomService
|
|||||||
player.setPlayerListFooter(FUtil.colorize(ConfigEntry.SERVER_TABLIST_FOOTER.getString()).replace("\\n", "\n"));
|
player.setPlayerListFooter(FUtil.colorize(ConfigEntry.SERVER_TABLIST_FOOTER.getString()).replace("\\n", "\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player p : Command_vanish.VANISHED)
|
for (Player p : plugin.al.vanished)
|
||||||
{
|
{
|
||||||
if (!plugin.al.isAdmin(player))
|
if (!plugin.al.isAdmin(player))
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,8 @@ 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.masterbuilder.MasterBuilderWorldRestrictions;
|
||||||
|
import me.totalfreedom.totalfreedommod.permissions.PermissionConfig;
|
||||||
|
import me.totalfreedom.totalfreedommod.permissions.PermissionManager;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerList;
|
import me.totalfreedom.totalfreedommod.player.PlayerList;
|
||||||
import me.totalfreedom.totalfreedommod.playerverification.PlayerVerification;
|
import me.totalfreedom.totalfreedommod.playerverification.PlayerVerification;
|
||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentList;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentList;
|
||||||
@ -72,6 +74,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
public static String pluginVersion;
|
public static String pluginVersion;
|
||||||
//
|
//
|
||||||
public MainConfig config;
|
public MainConfig config;
|
||||||
|
public PermissionConfig permissions;
|
||||||
//
|
//
|
||||||
// Services
|
// Services
|
||||||
public ServiceManager<TotalFreedomMod> services;
|
public ServiceManager<TotalFreedomMod> services;
|
||||||
@ -100,6 +103,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
public PunishmentList pul;
|
public PunishmentList pul;
|
||||||
public BanManager bm;
|
public BanManager bm;
|
||||||
public PermbanList pm;
|
public PermbanList pm;
|
||||||
|
public PermissionManager pem;
|
||||||
public VPNBanList vn;
|
public VPNBanList vn;
|
||||||
public ProtectArea pa;
|
public ProtectArea pa;
|
||||||
public GameRuleHandler gr;
|
public GameRuleHandler gr;
|
||||||
@ -176,6 +180,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
backups.createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
|
backups.createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
|
||||||
backups.createBackups(AdminList.CONFIG_FILENAME);
|
backups.createBackups(AdminList.CONFIG_FILENAME);
|
||||||
backups.createBackups(PermbanList.CONFIG_FILENAME);
|
backups.createBackups(PermbanList.CONFIG_FILENAME);
|
||||||
|
backups.createBackups(PermissionConfig.PERMISSIONS_FILENAME, true);
|
||||||
backups.createBackups(VPNBanList.CONFIG_FILENAME);
|
backups.createBackups(VPNBanList.CONFIG_FILENAME);
|
||||||
backups.createBackups(MasterBuilder.CONFIG_FILENAME);
|
backups.createBackups(MasterBuilder.CONFIG_FILENAME);
|
||||||
backups.createBackups(PunishmentList.CONFIG_FILENAME);
|
backups.createBackups(PunishmentList.CONFIG_FILENAME);
|
||||||
@ -183,6 +188,9 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
config = new MainConfig(this);
|
config = new MainConfig(this);
|
||||||
config.load();
|
config.load();
|
||||||
|
|
||||||
|
permissions = new PermissionConfig(this);
|
||||||
|
permissions.load();
|
||||||
|
|
||||||
// Start services
|
// Start services
|
||||||
services = new ServiceManager<>(plugin);
|
services = new ServiceManager<>(plugin);
|
||||||
si = services.registerService(ServerInterface.class);
|
si = services.registerService(ServerInterface.class);
|
||||||
@ -213,6 +221,7 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
pul = services.registerService(PunishmentList.class);
|
pul = services.registerService(PunishmentList.class);
|
||||||
bm = services.registerService(BanManager.class);
|
bm = services.registerService(BanManager.class);
|
||||||
pm = services.registerService(PermbanList.class);
|
pm = services.registerService(PermbanList.class);
|
||||||
|
pem = services.registerService(PermissionManager.class);
|
||||||
vn = services.registerService(VPNBanList.class);
|
vn = services.registerService(VPNBanList.class);
|
||||||
pa = services.registerService(ProtectArea.class);
|
pa = services.registerService(ProtectArea.class);
|
||||||
gr = services.registerService(GameRuleHandler.class);
|
gr = services.registerService(GameRuleHandler.class);
|
||||||
|
@ -38,6 +38,7 @@ public class AdminList extends FreedomService
|
|||||||
private final Map<String, Admin> ipTable = Maps.newHashMap();
|
private final Map<String, Admin> ipTable = Maps.newHashMap();
|
||||||
public final List<String> verifiedNoAdmins = new ArrayList<>();
|
public final List<String> verifiedNoAdmins = new ArrayList<>();
|
||||||
public final Map<String, List<String>> verifiedNoAdminIps = Maps.newHashMap();
|
public final Map<String, List<String>> verifiedNoAdminIps = Maps.newHashMap();
|
||||||
|
public static ArrayList<Player> vanished = new ArrayList<>();
|
||||||
//
|
//
|
||||||
private final YamlConfig config;
|
private final YamlConfig config;
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import com.earth2me.essentials.Essentials;
|
|||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.command.Command_vanish;
|
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
@ -40,7 +39,6 @@ public class EssentialsBridge extends FreedomService
|
|||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
protected void onStop()
|
||||||
{
|
{
|
||||||
Command_vanish.VANISHED.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Essentials getEssentialsPlugin()
|
public Essentials getEssentialsPlugin()
|
||||||
@ -215,10 +213,6 @@ public class EssentialsBridge extends FreedomService
|
|||||||
public void onPlayerQuit(PlayerQuitEvent event)
|
public void onPlayerQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (Command_vanish.VANISHED.contains(player))
|
|
||||||
{
|
|
||||||
Command_vanish.VANISHED.remove(player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnabled()
|
public boolean isEnabled()
|
||||||
|
@ -12,26 +12,22 @@ import org.bukkit.plugin.Plugin;
|
|||||||
public class WorldEditBridge extends FreedomService
|
public class WorldEditBridge extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
private final WorldEditListener listener;
|
|
||||||
//
|
//
|
||||||
private WorldEditPlugin worldeditPlugin = null;
|
private WorldEditPlugin worldeditPlugin = null;
|
||||||
|
|
||||||
public WorldEditBridge(TotalFreedomMod plugin)
|
public WorldEditBridge(TotalFreedomMod plugin)
|
||||||
{
|
{
|
||||||
super(plugin);
|
super(plugin);
|
||||||
listener = new WorldEditListener(plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
protected void onStart()
|
||||||
{
|
{
|
||||||
listener.register();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
protected void onStop()
|
||||||
{
|
{
|
||||||
listener.unregister();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldEditPlugin getWorldEditPlugin()
|
public WorldEditPlugin getWorldEditPlugin()
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.bridge;
|
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import me.totalfreedom.worldedit.LimitChangedEvent;
|
|
||||||
import me.totalfreedom.worldedit.SelectionChangedEvent;
|
|
||||||
import net.pravian.aero.component.PluginListener;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
|
|
||||||
public class WorldEditListener extends PluginListener<TotalFreedomMod>
|
|
||||||
{
|
|
||||||
|
|
||||||
public WorldEditListener(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onSelectionChange(final SelectionChangedEvent event)
|
|
||||||
{
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
|
|
||||||
if (plugin.al.isAdmin(player))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plugin.pa.isInProtectedArea(
|
|
||||||
event.getMinVector(),
|
|
||||||
event.getMaxVector(),
|
|
||||||
event.getWorld().getName()))
|
|
||||||
{
|
|
||||||
player.sendMessage(ChatColor.RED + "The region that you selected contained a protected area. Selection cleared.");
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onLimitChanged(LimitChangedEvent event)
|
|
||||||
{
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
|
|
||||||
if (plugin.al.isAdmin(player))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!event.getPlayer().equals(event.getTarget()))
|
|
||||||
{
|
|
||||||
player.sendMessage(ChatColor.RED + "Only admins can change the limit for other players!");
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.getLimit() < 0 || event.getLimit() > 200000)
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
player.sendMessage(ChatColor.RED + "You cannot set your limit higher than 200000 or to -1!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +1,19 @@
|
|||||||
package me.totalfreedom.totalfreedommod.bridge;
|
package me.totalfreedom.totalfreedommod.bridge;
|
||||||
|
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldguard.WorldGuard;
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
|
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||||
import java.util.Map;
|
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.FLog;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class WorldGuardBridge extends FreedomService
|
public class WorldGuardBridge extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
private WorldGuardPlugin worldGuardPlugin;
|
|
||||||
|
|
||||||
public WorldGuardBridge(TotalFreedomMod plugin)
|
public WorldGuardBridge(TotalFreedomMod plugin)
|
||||||
{
|
{
|
||||||
super(plugin);
|
super(plugin);
|
||||||
@ -30,31 +29,16 @@ public class WorldGuardBridge extends FreedomService
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldGuardPlugin getWorldGuardPlugin()
|
public RegionManager getRegionManager(World world)
|
||||||
{
|
{
|
||||||
if (worldGuardPlugin == null)
|
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||||
{
|
return container.get(BukkitAdapter.adapt(world));
|
||||||
try
|
|
||||||
{
|
|
||||||
final Plugin worldGuard = server.getPluginManager().getPlugin("WorldGuard");
|
|
||||||
if (worldGuard != null && worldGuard instanceof WorldGuardPlugin)
|
|
||||||
{
|
|
||||||
worldGuardPlugin = (WorldGuardPlugin)worldGuard;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
FLog.severe(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return worldGuardPlugin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int wipeRegions(World world)
|
public int wipeRegions(World world)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
RegionManager regionManager = getWorldGuardPlugin().getRegionManager(world);
|
RegionManager regionManager = getRegionManager(world);
|
||||||
if (regionManager != null)
|
if (regionManager != null)
|
||||||
{
|
{
|
||||||
Map<String, ProtectedRegion> regions = regionManager.getRegions();
|
Map<String, ProtectedRegion> regions = regionManager.getRegions();
|
||||||
@ -69,8 +53,8 @@ public class WorldGuardBridge extends FreedomService
|
|||||||
|
|
||||||
public boolean isEnabled()
|
public boolean isEnabled()
|
||||||
{
|
{
|
||||||
final WorldGuardPlugin wg = getWorldGuardPlugin();
|
Plugin plugin = server.getPluginManager().getPlugin("WorldGuard");
|
||||||
|
|
||||||
return wg != null && wg.isEnabled();
|
return plugin != null && plugin.isEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,7 +21,7 @@ public class Command_cartsit extends FreedomCommand
|
|||||||
|
|
||||||
targetPlayer = getPlayer(args[0]);
|
targetPlayer = getPlayer(args[0]);
|
||||||
|
|
||||||
if (targetPlayer == null || Command_vanish.VANISHED.contains(targetPlayer) && !plugin.al.isAdmin(sender))
|
if (targetPlayer == null || plugin.al.vanished.contains(targetPlayer) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,50 +1,59 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.command.Command;
|
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.BOTH)
|
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Deop a player.", usage = "/<command> <playername>")
|
@CommandParameters(description = "Deop a player", usage = "/<command> <partialname>")
|
||||||
public class Command_deop extends FreedomCommand
|
public class Command_deop extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
OfflinePlayer player = null;
|
boolean silent = false;
|
||||||
|
if (args.length == 2)
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
|
||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
|
silent = args[1].equalsIgnoreCase("-s");
|
||||||
{
|
|
||||||
player = onlinePlayer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the player is not online
|
final String targetName = args[0].toLowerCase();
|
||||||
if (player == null)
|
|
||||||
|
final List<String> matchedPlayerNames = new ArrayList<>();
|
||||||
|
for (final Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
player = DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName))
|
||||||
}
|
{
|
||||||
|
if (player.isOp() && !plugin.al.vanished.contains(player))
|
||||||
FUtil.adminAction(sender.getName(), "De-opping " + player.getName(), false);
|
{
|
||||||
|
matchedPlayerNames.add(player.getName());
|
||||||
player.setOp(false);
|
player.setOp(false);
|
||||||
|
player.sendMessage(FreedomCommand.YOU_ARE_NOT_OP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (player.isOnline())
|
if (!matchedPlayerNames.isEmpty())
|
||||||
{
|
{
|
||||||
Player p = (Player)player;
|
if (!silent)
|
||||||
p.sendMessage(YOU_ARE_NOT_OP);
|
{
|
||||||
|
FUtil.adminAction(sender.getName(), "De-opping " + StringUtils.join(matchedPlayerNames, ", "), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg("No targets matched.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -42,7 +42,7 @@ public class Command_invis extends FreedomCommand
|
|||||||
|
|
||||||
for (Player player : server.getOnlinePlayers())
|
for (Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !Command_vanish.VANISHED.contains(player))
|
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.al.vanished.contains(player))
|
||||||
{
|
{
|
||||||
players.add(player.getName());
|
players.add(player.getName());
|
||||||
if (clear && !plugin.al.isAdmin(player))
|
if (clear && !plugin.al.isAdmin(player))
|
||||||
|
@ -23,7 +23,7 @@ public class Command_invsee extends FreedomCommand
|
|||||||
|
|
||||||
Player player = getPlayer(args[0]);
|
Player player = getPlayer(args[0]);
|
||||||
|
|
||||||
if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
|
if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
msg("This player is not online.");
|
msg("This player is not online.");
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,7 +71,7 @@ public class Command_list extends FreedomCommand
|
|||||||
}
|
}
|
||||||
StringBuilder onlineStats = new StringBuilder();
|
StringBuilder onlineStats = new StringBuilder();
|
||||||
StringBuilder onlineUsers = new StringBuilder();
|
StringBuilder onlineUsers = new StringBuilder();
|
||||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - Command_vanish.VANISHED.size())
|
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - plugin.al.vanished.size())
|
||||||
.append(ChatColor.BLUE)
|
.append(ChatColor.BLUE)
|
||||||
.append(" out of a maximum ")
|
.append(" out of a maximum ")
|
||||||
.append(ChatColor.RED)
|
.append(ChatColor.RED)
|
||||||
@ -85,11 +85,11 @@ public class Command_list extends FreedomCommand
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (listFilter == ListFilter.ADMINS && Command_vanish.VANISHED.contains(p))
|
if (listFilter == ListFilter.ADMINS && plugin.al.vanished.contains(p))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (listFilter == ListFilter.VANISHED_ADMINS && !Command_vanish.VANISHED.contains(p))
|
if (listFilter == ListFilter.VANISHED_ADMINS && !plugin.al.vanished.contains(p))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ public class Command_list extends FreedomCommand
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (listFilter == ListFilter.PLAYERS && Command_vanish.VANISHED.contains(p))
|
if (listFilter == ListFilter.PLAYERS && plugin.al.vanished.contains(p))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.sk89q.worldedit.regions.Region;
|
|||||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||||
import com.sk89q.worldguard.protection.flags.Flag;
|
import com.sk89q.worldguard.protection.flags.Flag;
|
||||||
import com.sk89q.worldguard.protection.flags.Flags;
|
import com.sk89q.worldguard.protection.flags.Flags;
|
||||||
|
import com.sk89q.worldguard.protection.flags.RegionGroup;
|
||||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||||
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
||||||
@ -23,14 +24,15 @@ import org.bukkit.entity.Player;
|
|||||||
public class Command_makeopregion extends FreedomCommand
|
public class Command_makeopregion extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
final Map<Flag<?>, Object> flags = new HashMap<Flag<?>, Object>() {{
|
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.BLOCK_PLACE, StateFlag.State.ALLOW);
|
||||||
put(Flags.BUILD, StateFlag.State.DENY);
|
put(Flags.BLOCK_BREAK, StateFlag.State.ALLOW);
|
||||||
put(Flags.PLACE_VEHICLE, StateFlag.State.DENY);
|
put(Flags.BUILD, StateFlag.State.ALLOW);
|
||||||
put(Flags.DESTROY_VEHICLE, StateFlag.State.DENY);
|
put(Flags.PLACE_VEHICLE, StateFlag.State.ALLOW);
|
||||||
put(Flags.ENTITY_ITEM_FRAME_DESTROY, StateFlag.State.DENY);
|
put(Flags.DESTROY_VEHICLE, StateFlag.State.ALLOW);
|
||||||
put(Flags.ENTITY_PAINTING_DESTROY, StateFlag.State.DENY);
|
put(Flags.ENTITY_ITEM_FRAME_DESTROY, StateFlag.State.ALLOW);
|
||||||
|
put(Flags.ENTITY_PAINTING_DESTROY, 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)
|
||||||
@ -78,7 +80,12 @@ public class Command_makeopregion extends FreedomCommand
|
|||||||
region.setOwners(owners);
|
region.setOwners(owners);
|
||||||
region.setFlags(flags);
|
region.setFlags(flags);
|
||||||
|
|
||||||
RegionManager regionManager = plugin.wgb.getWorldGuardPlugin().getRegionManager(playerSender.getWorld());
|
for (Flag flag : flags.keySet())
|
||||||
|
{
|
||||||
|
region.setFlag(flag.getRegionGroupFlag(), RegionGroup.MEMBERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
RegionManager regionManager = plugin.wgb.getRegionManager(playerSender.getWorld());
|
||||||
|
|
||||||
regionManager.addRegion(region);
|
regionManager.addRegion(region);
|
||||||
|
|
||||||
|
@ -41,11 +41,11 @@ public class Command_nickfilter extends FreedomCommand
|
|||||||
|
|
||||||
player = getPlayerByDisplayName(displayName);
|
player = getPlayerByDisplayName(displayName);
|
||||||
|
|
||||||
if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
|
if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
player = getPlayerByDisplayNameAlt(displayName);
|
player = getPlayerByDisplayNameAlt(displayName);
|
||||||
|
|
||||||
if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
|
if (player == null || !plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
|
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,64 +1,59 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.ChatColor;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.command.Command;
|
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.OP, source = SourceType.BOTH, cooldown = 5)
|
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH, cooldown = 5)
|
||||||
@CommandParameters(description = "OPs the specified player.", usage = "/<command> <playername>")
|
@CommandParameters(description = "OP a player", usage = "/<command> <partialname>")
|
||||||
public class Command_op extends FreedomCommand
|
public class Command_op extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone"))
|
boolean silent = false;
|
||||||
|
if (args.length == 2)
|
||||||
{
|
{
|
||||||
msg("Correct usage: /opall");
|
silent = args[1].equalsIgnoreCase("-s");
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OfflinePlayer player = null;
|
final String targetName = args[0].toLowerCase();
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
|
||||||
|
final List<String> matchedPlayerNames = new ArrayList<>();
|
||||||
|
for (final Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
|
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName))
|
||||||
{
|
{
|
||||||
player = onlinePlayer;
|
if (!player.isOp() && !plugin.al.vanished.contains(player))
|
||||||
|
{
|
||||||
|
matchedPlayerNames.add(player.getName());
|
||||||
|
player.setOp(true);
|
||||||
|
player.sendMessage(FreedomCommand.YOU_ARE_OP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the player is not online or is vanished
|
if (!matchedPlayerNames.isEmpty())
|
||||||
if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
|
|
||||||
{
|
{
|
||||||
if (plugin.al.isAdmin(sender) || senderIsConsole)
|
if (!silent)
|
||||||
{
|
{
|
||||||
player = DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
FUtil.adminAction(sender.getName(), "Opping " + StringUtils.join(matchedPlayerNames, ", "), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg("That player is not online.");
|
msg("No targets matched.");
|
||||||
msg("You don't have permissions to OP offline players.", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FUtil.adminAction(sender.getName(), "Opping " + player.getName(), false);
|
|
||||||
player.setOp(true);
|
|
||||||
|
|
||||||
if (player.isOnline())
|
|
||||||
{
|
|
||||||
Player p = (Player)player;
|
|
||||||
p.sendMessage(YOU_ARE_OP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
|
|
||||||
|
@CommandPermissions(level = Rank.NON_OP, source = SourceType.BOTH)
|
||||||
|
@CommandParameters(description = "Check your permissions", usage = "/<command> [prefix | reload]")
|
||||||
|
public class Command_permissions extends FreedomCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
if (args.length > 0 && args[0].equals("reload") && plugin.al.isAdmin(sender))
|
||||||
|
{
|
||||||
|
plugin.permissions.load();
|
||||||
|
plugin.pem.loadPermissionNodes();
|
||||||
|
plugin.pem.updatePlayers();
|
||||||
|
msg("Reloaded permissions");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String prefix = "";
|
||||||
|
if (args.length > 0)
|
||||||
|
{
|
||||||
|
prefix = args[0];
|
||||||
|
}
|
||||||
|
checkPlayer();
|
||||||
|
List<String> permissions = new ArrayList<>();
|
||||||
|
for (PermissionAttachmentInfo attachmentInfo : playerSender.getEffectivePermissions())
|
||||||
|
{
|
||||||
|
if (attachmentInfo.getValue())
|
||||||
|
{
|
||||||
|
String permission = attachmentInfo.getPermission();
|
||||||
|
if (!prefix.isEmpty() && !permission.startsWith(prefix))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
permissions.add(permission);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
msg(String.join(", ", permissions));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -62,7 +62,7 @@ public class Command_potion extends FreedomCommand
|
|||||||
{
|
{
|
||||||
target = getPlayer(args[1]);
|
target = getPlayer(args[1]);
|
||||||
|
|
||||||
if (target == null || Command_vanish.VANISHED.contains(target) && !plugin.al.isAdmin(sender))
|
if (target == null || plugin.al.vanished.contains(target) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||||
return true;
|
return true;
|
||||||
@ -105,7 +105,7 @@ public class Command_potion extends FreedomCommand
|
|||||||
{
|
{
|
||||||
target = getPlayer(args[4]);
|
target = getPlayer(args[4]);
|
||||||
|
|
||||||
if (target == null || Command_vanish.VANISHED.contains(target) && !plugin.al.isAdmin(sender))
|
if (target == null || plugin.al.vanished.contains(target) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
|
||||||
@CommandParameters(description = "Quickly deop someone based on only their partial name.", usage = "/<command> <partialname>")
|
|
||||||
public class Command_qdeop extends FreedomCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
if (args.length < 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean silent = false;
|
|
||||||
if (args.length == 2)
|
|
||||||
{
|
|
||||||
silent = args[1].equalsIgnoreCase("-s");
|
|
||||||
}
|
|
||||||
|
|
||||||
final String targetName = args[0].toLowerCase();
|
|
||||||
|
|
||||||
final List<String> matchedPlayerNames = new ArrayList<>();
|
|
||||||
for (final Player player : server.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName))
|
|
||||||
{
|
|
||||||
if (player.isOp() && !Command_vanish.VANISHED.contains(player))
|
|
||||||
{
|
|
||||||
matchedPlayerNames.add(player.getName());
|
|
||||||
player.setOp(false);
|
|
||||||
player.sendMessage(FreedomCommand.YOU_ARE_NOT_OP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!matchedPlayerNames.isEmpty())
|
|
||||||
{
|
|
||||||
if (!silent)
|
|
||||||
{
|
|
||||||
FUtil.adminAction(sender.getName(), "De-opping " + StringUtils.join(matchedPlayerNames, ", "), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg("No targets matched.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH, cooldown = 5)
|
|
||||||
@CommandParameters(description = "Quickly OP someone based on only their partial name.", usage = "/<command> <partialname>")
|
|
||||||
public class Command_qop extends FreedomCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
if (args.length < 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean silent = false;
|
|
||||||
if (args.length == 2)
|
|
||||||
{
|
|
||||||
silent = args[1].equalsIgnoreCase("-s");
|
|
||||||
}
|
|
||||||
|
|
||||||
final String targetName = args[0].toLowerCase();
|
|
||||||
|
|
||||||
final List<String> matchedPlayerNames = new ArrayList<>();
|
|
||||||
for (final Player player : server.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName))
|
|
||||||
{
|
|
||||||
if (!player.isOp() && !Command_vanish.VANISHED.contains(player))
|
|
||||||
{
|
|
||||||
matchedPlayerNames.add(player.getName());
|
|
||||||
player.setOp(true);
|
|
||||||
player.sendMessage(FreedomCommand.YOU_ARE_OP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!matchedPlayerNames.isEmpty())
|
|
||||||
{
|
|
||||||
if (!silent)
|
|
||||||
{
|
|
||||||
FUtil.adminAction(sender.getName(), "Opping " + StringUtils.join(matchedPlayerNames, ", "), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg("No targets matched.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -37,7 +37,7 @@ public class Command_rank extends FreedomCommand
|
|||||||
|
|
||||||
final Player player = getPlayer(args[0]);
|
final Player player = getPlayer(args[0]);
|
||||||
|
|
||||||
if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
|
if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||||
return true;
|
return true;
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import com.connorlinfoot.actionbarapi.ActionBarAPI;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||||
|
@CommandParameters(description = "Brings the current reaction string up on your action bar", usage = "/<command>")
|
||||||
|
public class Command_reactionbar extends FreedomCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!plugin.sh.reactionString.isEmpty())
|
||||||
|
{
|
||||||
|
ActionBarAPI.sendActionBar(playerSender, ChatColor.BOLD + plugin.sh.reactionString, 15 * 20);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -23,7 +23,7 @@ public class Command_report extends FreedomCommand
|
|||||||
|
|
||||||
Player player = getPlayer(args[0]);
|
Player player = getPlayer(args[0]);
|
||||||
|
|
||||||
if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
|
if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
msg(PLAYER_NOT_FOUND);
|
msg(PLAYER_NOT_FOUND);
|
||||||
return true;
|
return true;
|
||||||
|
@ -84,7 +84,7 @@ public class Command_ride extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Player player = getPlayer(args[0]);
|
final Player player = getPlayer(args[0]);
|
||||||
if (player == null || Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
|
if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
msg(PLAYER_NOT_FOUND);
|
msg(PLAYER_NOT_FOUND);
|
||||||
return true;
|
return true;
|
||||||
|
@ -53,7 +53,7 @@ public class Command_tag extends FreedomCommand
|
|||||||
|
|
||||||
for (final Player player : server.getOnlinePlayers())
|
for (final Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (Command_vanish.VANISHED.contains(player) && !plugin.al.isAdmin(sender))
|
if (plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
|
|||||||
@CommandParameters(description = "Vanish/unvanish yourself.", usage = "/<command> [-s[ilent]]", aliases = "v")
|
@CommandParameters(description = "Vanish/unvanish yourself.", usage = "/<command> [-s[ilent]]", aliases = "v")
|
||||||
public class Command_vanish extends FreedomCommand
|
public class Command_vanish extends FreedomCommand
|
||||||
{
|
{
|
||||||
public static ArrayList<Player> VANISHED = new ArrayList<>();
|
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@ -36,7 +35,7 @@ public class Command_vanish extends FreedomCommand
|
|||||||
silent = true;
|
silent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (VANISHED.contains(playerSender))
|
if (plugin.al.vanished.contains(playerSender))
|
||||||
{
|
{
|
||||||
msg(ChatColor.GOLD + "You have been unvanished.");
|
msg(ChatColor.GOLD + "You have been unvanished.");
|
||||||
if (admin.hasLoginMessage())
|
if (admin.hasLoginMessage())
|
||||||
@ -68,7 +67,7 @@ public class Command_vanish extends FreedomCommand
|
|||||||
}
|
}
|
||||||
plugin.esb.setVanished(playerSender.getName(), false);
|
plugin.esb.setVanished(playerSender.getName(), false);
|
||||||
playerSender.setPlayerListName(StringUtils.substring(displayName, 0, 16));
|
playerSender.setPlayerListName(StringUtils.substring(displayName, 0, 16));
|
||||||
VANISHED.remove(playerSender);
|
plugin.al.vanished.remove(playerSender);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -89,7 +88,7 @@ public class Command_vanish extends FreedomCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
plugin.esb.setVanished(playerSender.getName(), true);
|
plugin.esb.setVanished(playerSender.getName(), true);
|
||||||
VANISHED.add(playerSender);
|
plugin.al.vanished.add(playerSender);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class Command_whohas extends FreedomCommand
|
|||||||
|
|
||||||
for (final Player player : server.getOnlinePlayers())
|
for (final Player player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (!plugin.al.isAdmin(sender) && Command_vanish.VANISHED.contains(player))
|
if (!plugin.al.isAdmin(sender) && plugin.al.vanished.contains(player))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,12 @@ public class Module_permbans extends HTTPDModule
|
|||||||
{
|
{
|
||||||
File permbanFile = new File(plugin.getDataFolder(), PermbanList.CONFIG_FILENAME);
|
File permbanFile = new File(plugin.getDataFolder(), PermbanList.CONFIG_FILENAME);
|
||||||
|
|
||||||
// if people get mad that opening the permban list to the public causes a mass DDoS attack on the server due to ip
|
final String remoteAddress = socket.getInetAddress().getHostAddress();
|
||||||
// leaks, it wasnt my idea
|
|
||||||
|
|
||||||
/*final String remoteAddress = socket.getInetAddress().getHostAddress();
|
|
||||||
if (!isAuthorized(remoteAddress))
|
if (!isAuthorized(remoteAddress))
|
||||||
{
|
{
|
||||||
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
||||||
"You may not view the permban list. Your IP, " + remoteAddress + ", is not registered to an admin on the server.");
|
"You may not view the permban list. Your IP, " + remoteAddress + ", is not registered to an admin on the server.");
|
||||||
}*/
|
}
|
||||||
if (permbanFile.exists())
|
if (permbanFile.exists())
|
||||||
{
|
{
|
||||||
return HTTPDaemon.serveFileBasic(new File(plugin.getDataFolder(), PermbanList.CONFIG_FILENAME));
|
return HTTPDaemon.serveFileBasic(new File(plugin.getDataFolder(), PermbanList.CONFIG_FILENAME));
|
||||||
|
@ -0,0 +1,184 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.permissions;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.List;
|
||||||
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
|
import net.pravian.aero.component.PluginComponent;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
public class PermissionConfig extends PluginComponent<TotalFreedomMod>
|
||||||
|
{
|
||||||
|
|
||||||
|
public static final String PERMISSIONS_FILENAME = "permissions.yml";
|
||||||
|
//
|
||||||
|
private final EnumMap<PermissionEntry, Object> entries;
|
||||||
|
private final PermissionDefaults defaults;
|
||||||
|
public YamlConfiguration configuration;
|
||||||
|
|
||||||
|
public PermissionConfig(TotalFreedomMod plugin)
|
||||||
|
{
|
||||||
|
super(plugin);
|
||||||
|
|
||||||
|
entries = new EnumMap<>(PermissionEntry.class);
|
||||||
|
|
||||||
|
PermissionDefaults tempDefaults = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
try (InputStream defaultConfig = getDefaultConfig())
|
||||||
|
{
|
||||||
|
tempDefaults = new PermissionDefaults(defaultConfig);
|
||||||
|
for (PermissionEntry entry : PermissionEntry.values())
|
||||||
|
{
|
||||||
|
entries.put(entry, tempDefaults.get(entry.getConfigName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
FLog.severe(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
copyDefaultConfig(getConfigFile());
|
||||||
|
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
FLog.severe(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
defaults = tempDefaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
YamlConfiguration config = new YamlConfiguration();
|
||||||
|
|
||||||
|
config.load(getConfigFile());
|
||||||
|
|
||||||
|
configuration = config;
|
||||||
|
|
||||||
|
for (PermissionEntry entry : PermissionEntry.values())
|
||||||
|
{
|
||||||
|
String path = entry.getConfigName();
|
||||||
|
if (config.contains(path))
|
||||||
|
{
|
||||||
|
Object value = config.get(path);
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
entries.put(entry, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FLog.warning("Missing permission entry " + entry.getConfigName() + ". Using default value.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException | InvalidConfigurationException ex)
|
||||||
|
{
|
||||||
|
FLog.severe(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private File getConfigFile()
|
||||||
|
{
|
||||||
|
return new File(plugin.getDataFolder(), PERMISSIONS_FILENAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List getList(PermissionEntry entry)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return get(entry, List.class);
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException ex)
|
||||||
|
{
|
||||||
|
FLog.severe(ex);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T get(PermissionEntry entry, Class<T> type) throws IllegalArgumentException
|
||||||
|
{
|
||||||
|
Object value = entries.get(entry);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return type.cast(value);
|
||||||
|
}
|
||||||
|
catch (ClassCastException ex)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException(entry.name() + " is not of type " + type.getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void set(PermissionEntry entry, T value)
|
||||||
|
{
|
||||||
|
entries.put(entry, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copyDefaultConfig(File targetFile)
|
||||||
|
{
|
||||||
|
if (targetFile.exists())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FLog.info("Installing default permission file template: " + targetFile.getPath());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
try (InputStream defaultConfig = getDefaultConfig())
|
||||||
|
{
|
||||||
|
FileUtils.copyInputStreamToFile(defaultConfig, targetFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
FLog.severe(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private InputStream getDefaultConfig()
|
||||||
|
{
|
||||||
|
return plugin.getResource(PERMISSIONS_FILENAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PermissionDefaults
|
||||||
|
{
|
||||||
|
|
||||||
|
private YamlConfiguration defaults = null;
|
||||||
|
|
||||||
|
private PermissionDefaults(InputStream defaultConfig)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
defaults = new YamlConfiguration();
|
||||||
|
final InputStreamReader isr = new InputStreamReader(defaultConfig);
|
||||||
|
defaults.load(isr);
|
||||||
|
isr.close();
|
||||||
|
}
|
||||||
|
catch (IOException | InvalidConfigurationException ex)
|
||||||
|
{
|
||||||
|
FLog.severe(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object get(String path)
|
||||||
|
{
|
||||||
|
return defaults.get(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.permissions;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
|
|
||||||
|
|
||||||
|
public enum PermissionEntry
|
||||||
|
{
|
||||||
|
REMOVE("remove"),
|
||||||
|
OPERATORS("operators"),
|
||||||
|
MASTER_BUILDERS("master_builders"),
|
||||||
|
SUPER_ADMINS("super_admins"),
|
||||||
|
TELNET_ADMINS("telnet_admins"),
|
||||||
|
SENIOR_ADMINS("senior_admins");
|
||||||
|
|
||||||
|
|
||||||
|
private final String configName;
|
||||||
|
|
||||||
|
PermissionEntry(String configName)
|
||||||
|
{
|
||||||
|
this.configName = configName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConfigName()
|
||||||
|
{
|
||||||
|
return configName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<?> getList()
|
||||||
|
{
|
||||||
|
return getConfig().getList(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public List<String> getEntry()
|
||||||
|
{
|
||||||
|
return (List<String>)getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private PermissionConfig getConfig()
|
||||||
|
{
|
||||||
|
return TotalFreedomMod.plugin().permissions;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,138 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.permissions;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Title;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
|
|
||||||
|
public class PermissionManager extends FreedomService
|
||||||
|
{
|
||||||
|
|
||||||
|
public Map<Displayable, List<String>> permissions = Maps.newHashMap();
|
||||||
|
|
||||||
|
public Map<Player, PermissionAttachment> attachments = Maps.newHashMap();
|
||||||
|
|
||||||
|
public PermissionManager(TotalFreedomMod plugin)
|
||||||
|
{
|
||||||
|
super(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart()
|
||||||
|
{
|
||||||
|
loadPermissionNodes();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadPermissionNodes()
|
||||||
|
{
|
||||||
|
|
||||||
|
FLog.info("Loading permission nodes...");
|
||||||
|
|
||||||
|
permissions.clear();
|
||||||
|
|
||||||
|
List<String> operatorPermissions;
|
||||||
|
List<String> masterBuilderPermissions;
|
||||||
|
List<String> superAdminPermissions;
|
||||||
|
List<String> telnetAdminPermissions;
|
||||||
|
List<String> seniorAdminPermissions;
|
||||||
|
|
||||||
|
operatorPermissions = PermissionEntry.OPERATORS.getEntry();
|
||||||
|
permissions.put(Rank.OP, operatorPermissions);
|
||||||
|
|
||||||
|
masterBuilderPermissions = PermissionEntry.MASTER_BUILDERS.getEntry();
|
||||||
|
masterBuilderPermissions.addAll(operatorPermissions);
|
||||||
|
permissions.put(Title.MASTER_BUILDER, masterBuilderPermissions);
|
||||||
|
|
||||||
|
|
||||||
|
superAdminPermissions = PermissionEntry.SUPER_ADMINS.getEntry();
|
||||||
|
superAdminPermissions.addAll(masterBuilderPermissions);
|
||||||
|
permissions.put(Rank.SUPER_ADMIN, superAdminPermissions);
|
||||||
|
|
||||||
|
telnetAdminPermissions = PermissionEntry.TELNET_ADMINS.getEntry();
|
||||||
|
telnetAdminPermissions.addAll(superAdminPermissions);
|
||||||
|
permissions.put(Rank.TELNET_ADMIN, superAdminPermissions);
|
||||||
|
|
||||||
|
seniorAdminPermissions = PermissionEntry.SENIOR_ADMINS.getEntry();
|
||||||
|
seniorAdminPermissions.addAll(telnetAdminPermissions);
|
||||||
|
permissions.put(Rank.SENIOR_ADMIN, seniorAdminPermissions);
|
||||||
|
|
||||||
|
FLog.info("Loaded " + permissions.values().size() + " permission nodes");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissions(Player player)
|
||||||
|
{
|
||||||
|
PermissionAttachment attachment = attachments.get(player);
|
||||||
|
|
||||||
|
if (attachment != null)
|
||||||
|
{
|
||||||
|
player.removeAttachment(attachment);
|
||||||
|
}
|
||||||
|
|
||||||
|
attachment = player.addAttachment(plugin);
|
||||||
|
|
||||||
|
for (PermissionAttachmentInfo attachmentInfo : player.getEffectivePermissions())
|
||||||
|
{
|
||||||
|
for (String rootNode : PermissionEntry.REMOVE.getEntry())
|
||||||
|
{
|
||||||
|
String permission = attachmentInfo.getPermission();
|
||||||
|
if (permission.startsWith(rootNode))
|
||||||
|
{
|
||||||
|
attachment.setPermission(attachmentInfo.getPermission(), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<String> nodes = permissions.get(plugin.rm.getRank(player));
|
||||||
|
if (nodes != null)
|
||||||
|
{
|
||||||
|
for (String node : nodes)
|
||||||
|
{
|
||||||
|
attachment.setPermission(node, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.mbl.isMasterBuilder(player) && !plugin.al.isAdmin(player))
|
||||||
|
{
|
||||||
|
if (nodes != null)
|
||||||
|
{
|
||||||
|
for (String node : permissions.get(Title.MASTER_BUILDER))
|
||||||
|
{
|
||||||
|
attachment.setPermission(node, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
attachments.put(player, attachment);
|
||||||
|
|
||||||
|
player.recalculatePermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePlayers()
|
||||||
|
{
|
||||||
|
for (Player player : server.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
setPermissions(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event)
|
||||||
|
{
|
||||||
|
setPermissions(event.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
@ -175,6 +175,7 @@ public class RankManager extends FreedomService
|
|||||||
fPlayer.setTag(null);
|
fPlayer.setTag(null);
|
||||||
player.setPlayerListName(null);
|
player.setPlayerListName(null);
|
||||||
}
|
}
|
||||||
|
plugin.pem.setPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
@ -51,7 +51,7 @@ public class FUtil
|
|||||||
//
|
//
|
||||||
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
||||||
// See https://github.com/TotalFreedom/License - None of the listed names may be removed.
|
// See https://github.com/TotalFreedom/License - None of the listed names may be removed.
|
||||||
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "Demonic_Mario", "RobinGall2910", "smartnt");
|
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "Demonic_Mario", "OxLemonxO");
|
||||||
public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z";
|
public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z";
|
||||||
public static final Map<String, ChatColor> CHAT_COLOR_NAMES = new HashMap<>();
|
public static final Map<String, ChatColor> CHAT_COLOR_NAMES = new HashMap<>();
|
||||||
public static final List<ChatColor> CHAT_COLOR_POOL = Arrays.asList(
|
public static final List<ChatColor> CHAT_COLOR_POOL = Arrays.asList(
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#
|
#
|
||||||
# TotalFreedomMod 5.2 Activity Log
|
# TotalFreedomMod 5.5 Activity Log
|
||||||
#
|
#
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# TotalFreedomMod 5.2 Admin List
|
# TotalFreedomMod 5.5 Admin List
|
||||||
#
|
#
|
||||||
|
|
||||||
prozza:
|
prozza:
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#
|
#
|
||||||
# TotalFreedomMod 5.2 Player Bans
|
# TotalFreedomMod 5.5 Player Bans
|
||||||
#
|
#
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# TotalFreedomMod 5.2 Configuration
|
# TotalFreedomMod 5.5 Configuration
|
||||||
# by Madgeek1450 and Prozza
|
# by Madgeek1450 and Prozza
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#
|
#
|
||||||
# TotalFreedomMod 5.2 Master Builder List
|
# TotalFreedomMod 5.5 Master Builder List
|
||||||
#
|
#
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# TotalFreedomMod 5.2 Permanent Bans
|
# TotalFreedomMod 5.5 Permanent Bans
|
||||||
#
|
#
|
||||||
|
|
||||||
badplayer1:
|
badplayer1:
|
||||||
|
78
src/main/resources/permissions.yml
Normal file
78
src/main/resources/permissions.yml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
#
|
||||||
|
# TotalFreedomMod 5.5 Permissions
|
||||||
|
# by ZeroEpoch1969
|
||||||
|
#
|
||||||
|
|
||||||
|
# Note that every group inherits the previous groups' permissions
|
||||||
|
# Meaning Telnet Admins have the permissions of Operators and Super Admins, and etc
|
||||||
|
|
||||||
|
# This is used to remove all permission begging with the root node
|
||||||
|
# This is useful when a plugin gives all permissions to a player because they are opped
|
||||||
|
remove:
|
||||||
|
- "coreprotect"
|
||||||
|
|
||||||
|
# Operator permission nodes
|
||||||
|
operators:
|
||||||
|
# WorldEdit
|
||||||
|
- "worldedit.help"
|
||||||
|
- "worldedit.history.undo.self"
|
||||||
|
- "worldedit.history.redo.self"
|
||||||
|
- "worldedit.history.clear"
|
||||||
|
- "worldedit.limit"
|
||||||
|
- "worldedit.reorder"
|
||||||
|
- "worldedit.drawsel"
|
||||||
|
- "worldedit.searchitem"
|
||||||
|
- "worldedit.navigation.*"
|
||||||
|
- "worldedit.selection.*"
|
||||||
|
- "worldedit.wand"
|
||||||
|
- "worldedit.wand.*"
|
||||||
|
- "worldedit.region.*"
|
||||||
|
- "worldedit.generation.*"
|
||||||
|
- "worldedit.clipboard.*"
|
||||||
|
- "worldedit.tool.info"
|
||||||
|
- "worldedit.biome.*"
|
||||||
|
- "worldedit.removeabove"
|
||||||
|
- "worldedit.removebelow"
|
||||||
|
- "worldedit.removenear"
|
||||||
|
- "worldedit.replacenear"
|
||||||
|
|
||||||
|
# CoreProtect
|
||||||
|
- "coreprotect.inspect"
|
||||||
|
- "coreprotect.lookup"
|
||||||
|
- "coreprotect.help"
|
||||||
|
- "coreprotect.status"
|
||||||
|
- "coreprotect.lookup.block"
|
||||||
|
- "coreprotect.lookup.click"
|
||||||
|
- "coreprotect.lookup.container"
|
||||||
|
- "coreprotect.container"
|
||||||
|
- "coreprotect.core"
|
||||||
|
- "coreprotect.coreprotect"
|
||||||
|
- "coreprotect.co"
|
||||||
|
|
||||||
|
# WorldGuard
|
||||||
|
- "worldgyardregion.list.own"
|
||||||
|
- "worldguard.region.addmember.own.*"
|
||||||
|
- "worldguard.region.removemember.own.*"
|
||||||
|
- "worldguard.region.info.*"
|
||||||
|
|
||||||
|
# Master Builder permission nodes
|
||||||
|
master_builders:
|
||||||
|
- "worldedit.tool.*"
|
||||||
|
- "worldedit.brush.*"
|
||||||
|
- "worldedit.snow"
|
||||||
|
- "worldedit.green"
|
||||||
|
- "worldedit.extinguish"
|
||||||
|
- "worldedit.thaw"
|
||||||
|
|
||||||
|
# Super Admin permission nodes
|
||||||
|
super_admins:
|
||||||
|
- "coreprotect.*"
|
||||||
|
- "worldedit.*"
|
||||||
|
- "worldguard.*"
|
||||||
|
|
||||||
|
# Telnet Admin permission nodes
|
||||||
|
telnet_admins: []
|
||||||
|
|
||||||
|
# Senior Admin permission nodes
|
||||||
|
senior_admins: []
|
||||||
|
|
@ -5,4 +5,4 @@ description: Plugin for the Total Freedom server.
|
|||||||
depend: [Aero]
|
depend: [Aero]
|
||||||
softdepend: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit]
|
softdepend: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit]
|
||||||
authors: [Madgeek1450, Prozza]
|
authors: [Madgeek1450, Prozza]
|
||||||
api-version: 1.14
|
api-version: 1.15
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#
|
#
|
||||||
# TotalFreedomMod 5.2 Player Punishments
|
# TotalFreedomMod 5.5 Player Punishments
|
||||||
#
|
#
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# TotalFreedomMod 5.2 VPN Bans
|
# TotalFreedomMod 5.5 VPN Bans
|
||||||
#
|
#
|
||||||
|
|
||||||
badnetwork1:
|
badnetwork1:
|
||||||
|
Loading…
Reference in New Issue
Block a user