Compare commits
8 Commits
6e96509069
...
1.4
Author | SHA1 | Date | |
---|---|---|---|
9aede116ac | |||
97fc283951 | |||
7e6c889583 | |||
a1ffd48f3e | |||
0c1d32e0e8 | |||
987370586a | |||
020f33da07 | |||
48196f446c |
6
pom.xml
6
pom.xml
@@ -7,7 +7,7 @@
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>Alias</artifactId>
|
||||
|
||||
<version>1.2.3_beta-1</version>
|
||||
<version>1.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>T2C-Alias</name>
|
||||
@@ -71,8 +71,8 @@
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>15.6</version>
|
||||
<classifier>dev-3</classifier>
|
||||
<version>15.7</version>
|
||||
<!--classifier>dev-3</classifier-->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@@ -52,7 +52,7 @@ public class ExecuteAlias {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (aliasObject.adminEnable) {
|
||||
if (player.hasPermission(aliasObject.adminPermission)) {
|
||||
if (player.hasPermission(aliasObject.adminPermission.replace("<alias>", alias.toLowerCase()))) {
|
||||
if (aliasObject.adminCommandEnable) {
|
||||
aliasAdminCommand(aliasObject, alias, player, args);
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class ExecuteAlias {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (aliasObject.adminEnable) {
|
||||
if (player.hasPermission(aliasObject.adminPermission)) {
|
||||
if (player.hasPermission(aliasObject.adminPermission.replace("<alias>", alias.toLowerCase()))){
|
||||
if (aliasObject.adminCommandEnable) {
|
||||
subAliasAdminCommand(aliasObject, alias, player, args);
|
||||
}
|
||||
|
@@ -17,8 +17,9 @@ import java.util.logging.Level;
|
||||
|
||||
public class Convert {
|
||||
protected static void convert() {
|
||||
File config = new File(Main.getPath(),"");
|
||||
if (config.exists()) convertTo4();
|
||||
File path = new File(Main.getPath(),"");
|
||||
File file = new File(Main.getPath(), "config.yml");
|
||||
if (path.exists() && file.exists()) convertTo4();
|
||||
}
|
||||
|
||||
private static void convertTo4() {
|
||||
@@ -26,7 +27,7 @@ public class Convert {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
if (yamlConfiguration.get(Config.configVersion.path) == null || ((Integer) Config.configVersion.value) < Util.getConfigVersion() && new File(Main.getPath(), "config.yml").exists()) {
|
||||
if (yamlConfiguration.get(Config.configVersion.path) == null || ((Integer) Config.configVersion.value) < Util.getConfigVersion()) {
|
||||
yamlConfiguration.set("ConfigVersion", null);
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
@@ -36,6 +37,9 @@ public class Convert {
|
||||
|
||||
File dir = new File(Main.getPath() + "/languages");
|
||||
File newDir = new File(Main.getPath() + "/OldConfig/Version3/languages");
|
||||
if (!dir.exists()){
|
||||
return;
|
||||
}
|
||||
try {
|
||||
FileUtils.moveDirectory(dir, newDir);
|
||||
} catch (IOException e) {
|
||||
|
@@ -32,7 +32,8 @@ public enum Language {
|
||||
confirmChat("cost.confirm.chat", null, "[prefix] <gold>Für diesen Befehl musst du [price] bezahlen!</gold><br>[prefix] <green><click:run_command:'t2code-alias-confirm'><hover:show_text:'<gray>Klicke zum bestätigen</gray>'>Bestätigen</hover></click></green> <gray>-</gray> <red><click:run_command:'t2code-alias-cancel'><hover:show_text:'<gray>Klicke zum abbrechen</gray>'>Abbrechen</hover></click></red>",
|
||||
"[prefix] <gold>For this command you have to pay [price]!</gold><br>[prefix] <green><click:run_command:'t2code-alias-confirm'><hover:show_text:'<gray>Click to confirm</gray>'>Confirm</hover></click></green> <gray>-</gray> <red><click:run_command:'t2code-alias-cancel'><hover:show_text:'<gray>click to cancel</gray>'>Cancel</hover></click></red>", ConfigParam.STRING),
|
||||
|
||||
confirmGuiTitle("cost.confirm.gui.title", null, "&2Bestätige den Zahlvorgang für: &6/[alias]", "Confirm the payment process for: &6/[alias]", ConfigParam.STRING),
|
||||
confirmGuiTitle("cost.confirm.gui.title", null, "&2Bestätige den Zahlvorgang für: &6/[alias]",
|
||||
"&2Confirm the payment process for: &6/[alias]", ConfigParam.STRING),
|
||||
confirmGuiConfirm("cost.confirm.gui.confirm.displayName", null, "&2Bestätigen", "&2Confirm", ConfigParam.STRING),
|
||||
confirmGuiConfirmLore("cost.confirm.gui.confirm.lore", null, Arrays.asList("&aDieser Befehl kostet", "&6[price]"),
|
||||
Arrays.asList("&aThis command costs","&6[price]"), ConfigParam.LIST),
|
||||
|
@@ -20,16 +20,16 @@ public class GuiListener implements Listener {
|
||||
if (e.getClickedInventory() != e.getWhoClicked().getOpenInventory().getTopInventory()) return;
|
||||
switch (e.getSlot()) {
|
||||
case 12:
|
||||
Cache.openPlayers.remove(player.getUniqueId());
|
||||
player.closeInventory();
|
||||
ExecuteAlias.storage(player, true);
|
||||
break;
|
||||
case 14:
|
||||
Cache.openPlayers.remove(player.getUniqueId());
|
||||
player.closeInventory();
|
||||
ExecuteAlias.storage(player, false);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Cache.openPlayers.remove(player.getUniqueId());
|
||||
player.closeInventory();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@@ -1,15 +1,35 @@
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class AliasRegisterPermissions {
|
||||
|
||||
public static void onPermRegister() {
|
||||
for (String alias : Main.allAliases){
|
||||
if (Bukkit.getPluginManager().getPermission("t2code.alias.use." + alias.toLowerCase()) == null) {
|
||||
T2Cregister.permission("t2code.alias.use." + alias.toLowerCase(), Main.getPlugin());
|
||||
|
||||
for (AliasObject aliasObject : Main.aliasHashMap.values()) {
|
||||
|
||||
for (String alias : aliasObject.aliasList){
|
||||
if (Bukkit.getPluginManager().getPermission(aliasObject.permission.replace("<alias>",alias).toLowerCase()) == null) {
|
||||
T2Cregister.permission(aliasObject.permission.replace("<alias>",alias).toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.replace("<alias>",alias).toLowerCase()) == null) {
|
||||
T2Cregister.permission(aliasObject.adminPermission.replace("<alias>",alias).toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (SubAliasObject subAliasObject : Main.subAliasHashMap.values()) {
|
||||
for (String alias : subAliasObject.subAliasList){
|
||||
if (Bukkit.getPluginManager().getPermission(subAliasObject.permission.replace("<alias>",alias).toLowerCase()) == null) {
|
||||
T2Cregister.permission(subAliasObject.permission.replace("<alias>",alias).toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.replace("<alias>",alias).toLowerCase()) == null) {
|
||||
T2Cregister.permission(subAliasObject.adminPermission.replace("<alias>",alias).toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,10 +44,11 @@ public class Load {
|
||||
public static void loadReload() {
|
||||
HandlerList.unregisterAll(chatListener);
|
||||
HandlerList.unregisterAll(guiListener);
|
||||
boolean newInstall = !new File(Main.getPath(), "config.yml").exists();
|
||||
FileSelect.config();
|
||||
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
|
||||
FileSelect.language();
|
||||
if (!new File(Main.getPath(), "config.yml").exists()) {
|
||||
if (newInstall) {
|
||||
try {
|
||||
CreateExampleAliasConfig.configCreate();
|
||||
} catch (Exception e) {
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@@ -8,7 +8,7 @@ public class Util {
|
||||
}
|
||||
|
||||
public static String getRequiredT2CodeLibVersion() {
|
||||
return "15.6";
|
||||
return "15.7";
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
|
@@ -78,6 +78,8 @@ Alias:
|
||||
# Here you can enable or disable the admin function
|
||||
Enable: false
|
||||
# Here you set the permission for the admin function
|
||||
# The placeholder <alias> is the alias name.
|
||||
# If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias.
|
||||
Permission: t2code.alias.admin
|
||||
Command:
|
||||
# Here you can tell the alias to execute one or more commands
|
||||
|
@@ -20,7 +20,7 @@ SubAlias:
|
||||
Necessary: true
|
||||
# Here you can set the permission for the alias.
|
||||
# The placeholder <alias> is the alias name.
|
||||
# If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias.
|
||||
# If you have set multiple alias referrers in the list 'Alias.SubAliasList' you have a permission for each alias.
|
||||
Permission: 't2code.alias.use.subalias.<alias>'
|
||||
# Here you can set a custom No Permission message for this alias. If you want to use the default message, just leave this blank.
|
||||
CustomNoPermissionMSG: ""
|
||||
@@ -82,6 +82,8 @@ SubAlias:
|
||||
# Here you can enable or disable the admin function
|
||||
Enable: false
|
||||
# Here you set the permission for the admin function
|
||||
# The placeholder <alias> is the alias name.
|
||||
# If you have set multiple alias referrers in the list 'Alias.SubAliasList' you have a permission for each alias.
|
||||
Permission: t2code.alias.admin
|
||||
Command:
|
||||
# Here you can tell the alias to execute one or more commands
|
||||
|
Reference in New Issue
Block a user