Rename & fix #75

This commit is contained in:
Norbi Peti 2019-10-20 15:10:09 +02:00
parent 1a6bd29741
commit 383e9dc8d5
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
14 changed files with 22 additions and 69 deletions

View file

@ -17,7 +17,7 @@
</set>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_12" default="false" project-jdk-name="11" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_12" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View file

@ -12,6 +12,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />

View file

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:15.0" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.12.2-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: com.google.code.gson:gson:2.8.0" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.12-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TBMCPlugins.ButtonCore:Towny:master-317b5a3bda-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.milkbowl:VaultAPI:master-af0353b1d7-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
<orderEntry type="library" name="Maven: org.mockito:mockito-core:3.0.0" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.9.10" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.10" level="project" />
<orderEntry type="library" name="Maven: org.objenesis:objenesis:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.8" level="project" />
<orderEntry type="module" module-name="ButtonProcessor" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:EssentialsX:2.17.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.17.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:UpdatedMetaProvider:2.17.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:1_8_R1Provider:2.17.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:1_8_R2Provider:2.17.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:LegacyProvider:2.17.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:ReflectionProvider:2.17.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:FlattenedProvider:2.17.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.vexsoftware:nuvotifier-universal:2.3.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.onarandombox.multiversecore:Multiverse-Core:4.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
</component>
</module>

View file

@ -6,11 +6,11 @@ import buttondevteam.lib.chat.ICommand2MC;
import org.bukkit.command.CommandSender;
@CommandClass
public class ThorpeCommand extends ICommand2MC {
public class ChromaCommand extends ICommand2MC {
@Command2.Subcommand //TODO: Main permissions (groups) like 'mod'
public void reload(CommandSender sender) {
if (MainPlugin.Instance.tryReloadConfig())
sender.sendMessage("§bConfig reloaded.");
sender.sendMessage("§bCore config reloaded.");
else
sender.sendMessage("§cFailed to reload config. Check console.");
}

View file

@ -97,7 +97,7 @@ public class MainPlugin extends ButtonPlugin {
Component.registerComponent(this, new VotifierComponent(economy));
ComponentManager.enableComponents();
getCommand2MC().registerCommand(new ComponentCommand());
getCommand2MC().registerCommand(new ThorpeCommand());
getCommand2MC().registerCommand(new ChromaCommand());
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
TBMCCoreAPI.RegisterEventsForExceptions(getCommand2MC(), this);
ChromaGamerBase.addConverter(commandSender -> Optional.ofNullable(commandSender instanceof ConsoleCommandSender || commandSender instanceof BlockCommandSender

View file

@ -93,7 +93,7 @@ public class PlayerListener implements Listener {
String msg = MainPlugin.Instance.chatFormat().get()
.replace("{channel}", event.getChannel().DisplayName().get())
.replace("{origin}", event.getOrigin().substring(0, 1))
.replace("{name}", ThorpeUtils.getDisplayName(event.getSender()))
.replace("{name}", ChromaUtils.getDisplayName(event.getSender()))
.replace("{message}", event.getMessage());
for (Player player : Bukkit.getOnlinePlayers())
if (event.shouldSendTo(player))

View file

@ -98,8 +98,8 @@ public class SpawnComponent extends Component<MainPlugin> implements PluginMessa
Bukkit.getScheduler().runTask(getPlugin(), () -> { //Delay it a bit
ByteArrayDataOutput outt = ByteStreams.newDataOutput();
outt.writeUTF("Forward"); // So BungeeCord knows to forward it
outt.writeUTF("ALL");
outt.writeUTF("ForwardToPlayer"); // So BungeeCord knows to forward it
outt.writeUTF(player.getName());
outt.writeUTF("ChromaCore-Spawn"); // The channel name to check if this your data
ByteArrayOutputStream msgbytes = new ByteArrayOutputStream();

View file

@ -9,8 +9,8 @@ import org.bukkit.event.Event;
import java.util.function.Supplier;
public final class ThorpeUtils {
private ThorpeUtils() {}
public final class ChromaUtils {
private ChromaUtils() {}
public static String getDisplayName(CommandSender sender) {
if (sender instanceof IHaveFancyName)

View file

@ -1,7 +1,7 @@
package buttondevteam.lib.architecture;
import buttondevteam.core.MainPlugin;
import buttondevteam.lib.ThorpeUtils;
import buttondevteam.lib.ChromaUtils;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -101,7 +101,7 @@ public class ConfigData<T> {
return hmm;
}
if (val instanceof Number && def != null)
val = ThorpeUtils.convertNumber((Number) val,
val = ChromaUtils.convertNumber((Number) val,
(Class<? extends Number>) def.getClass());
if (val instanceof List && def != null && def.getClass().isArray())
val = ((List<T>) val).toArray((T[]) Array.newInstance(def.getClass().getComponentType(), 0));

View file

@ -1,8 +1,8 @@
package buttondevteam.lib.chat;
import buttondevteam.core.MainPlugin;
import buttondevteam.lib.ChromaUtils;
import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.ThorpeUtils;
import buttondevteam.lib.player.ChromaGamerBase;
import com.google.common.base.Defaults;
import com.google.common.primitives.Primitives;
@ -60,7 +60,7 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
String[] helpText() default {};
/**
* The main permission which allows using this command (individual access can be still granted with "thorpe.command.X").
* The main permission which allows using this command (individual access can be still granted with "chroma.command.X").
* Used to be "tbmc.admin". The {@link #MOD_GROUP} is provided to use with this.
*/
String permGroup() default ""; //TODO
@ -208,7 +208,7 @@ public abstract class Command2<TC extends ICommand2, TP extends Command2Sender>
} else if (Number.class.isAssignableFrom(cl) || cl.isPrimitive()) {
try {
//noinspection unchecked
Number n = ThorpeUtils.convertNumber(NumberFormat.getInstance().parse(param), (Class<? extends Number>) cl);
Number n = ChromaUtils.convertNumber(NumberFormat.getInstance().parse(param), (Class<? extends Number>) cl);
params.add(n);
} catch (ParseException e) {
sender.sendMessage("§c'" + param + "' is not a number.");

View file

@ -24,7 +24,7 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> implemen
@Override
public void registerCommand(ICommand2MC command) {
super.registerCommand(command, '/');
var perm = "thorpe.command." + command.getCommandPath().replace(' ', '.');
var perm = "chroma.command." + command.getCommandPath().replace(' ', '.');
if (Bukkit.getPluginManager().getPermission(perm) == null) //Check needed for plugin reset
Bukkit.getPluginManager().addPermission(new Permission(perm,
modOnly(command) ? PermissionDefault.OP : PermissionDefault.TRUE)); //Allow commands by default, unless it's mod only - TODO: Test
@ -32,7 +32,7 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> implemen
if (!method.isAnnotationPresent(Subcommand.class)) continue;
String pg = permGroup(command, method);
if (pg.length() == 0) continue;
perm = "thorpe." + pg;
perm = "chroma." + pg;
if (Bukkit.getPluginManager().getPermission(perm) == null) //It may occur multiple times
Bukkit.getPluginManager().addPermission(new Permission(perm,
//pg.equals(Subcommand.MOD_GROUP) ? PermissionDefault.OP : PermissionDefault.TRUE)); //Allow commands by default, unless it's mod only
@ -50,8 +50,8 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> implemen
String pg;
boolean p = true;
String[] perms = {
"thorpe.command." + command.getCommandPath().replace(' ', '.'),
(pg = permGroup(command, method)).length() > 0 ? "thorpe." + pg : null,
"chroma.command." + command.getCommandPath().replace(' ', '.'),
(pg = permGroup(command, method)).length() > 0 ? "chroma." + pg : null,
modOnly(command) ? "tbmc.admin" : null
};
for (String perm : perms) {

View file

@ -46,7 +46,7 @@ public @interface CommandClass {
String[] helpText() default {};
/**
* The main permission which allows using this command (individual access can be still granted with "thorpe.command.X").
* The main permission which allows using this command (individual access can be still granted with "chroma.command.X").
* Used to be "tbmc.admin"
*/
String permGroup() default ""; //TODO: A single annotation instead of these two

View file

@ -287,7 +287,7 @@ public class TBMCChatAPI {
Bukkit.getPluginManager().callEvent(event);
return event.isCancelled();
};
return ThorpeUtils.doItAsync(task, false); //Not cancelled if async
return ChromaUtils.doItAsync(task, false); //Not cancelled if async
}
/**
@ -307,7 +307,7 @@ public class TBMCChatAPI {
if (!Arrays.asList(exceptions).contains("Minecraft"))
Bukkit.getConsoleSender().sendMessage("[" + channel.DisplayName().get() + "] " + message);
TBMCSystemChatEvent event = new TBMCSystemChatEvent(channel, message, rtr.score, rtr.groupID, exceptions, target);
return ThorpeUtils.callEventAsync(event);
return ChromaUtils.callEventAsync(event);
}
private static RecipientTestResult getScoreOrSendError(Channel channel, CommandSender sender) {

View file

@ -13,8 +13,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.21" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.21" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.21" level="project" />
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />