Skip to content

Commit

Permalink
Merge pull request #82 from MCME/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
EriolEandur authored Jun 16, 2024
2 parents 6ee1df7 + 55edc8e commit 68cb2c3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 36 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mcmiddleearth</groupId>
<artifactId>MCME-Architect</artifactId>
<version>2.9.12</version>
<version>2.9.13</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,75 +116,88 @@ public void run() {
}
ChatColor ccStressed = PluginData.getMessageUtil().STRESSED;
ChatColor ccInfo = PluginData.getMessageUtil().INFO;
if(args.length>0 && (args[0].equals("auto")
|| args[0].equals("client")
|| args[0].equals("variant"))) {
if(args.length>0 && (args[0].equalsIgnoreCase("auto")
|| args[0].equalsIgnoreCase("reset")
|| args[0].equalsIgnoreCase("client")
|| args[0].equalsIgnoreCase("variant"))) {
RpPlayerData data = RpManager.getPlayerData((Player)cs);
switch(args[0]) {
case "auto":
if(args.length<2) {
data.setAutoRp(!data.isAutoRp());
switch (args[0].toLowerCase()) {
case "auto" -> {
if (args.length < 2) {
data.setAutoRp(true);
} else {
data.setAutoRp(args[1].equals("on") || args[1].equals("true"));
data.setAutoRp(!(args[1].equals("off") || args[1].equals("false")));
}
String on = (data.isAutoRp()?"on":"off");
PluginData.getMessageUtil().sendInfoMessage(cs,"Auto rp switching set to "
+ccStressed+ on);
break;
case "px":
if(args.length<2) {
String on = (data.isAutoRp() ? "on" : "off");
PluginData.getMessageUtil().sendInfoMessage(cs, "Auto rp switching set to "
+ ccStressed + on);
}
case "reset" -> {
RpRegion rpRegion = RpManager.getRegion(((Player)cs).getLocation());
if(rpRegion == null) {
PluginData.getMessageUtil().sendInfoMessage(cs, "No server rp defined for your location.");
} else {
data.setAutoRp(true);
RpManager.setRp(rpRegion.getRp(),(Player)cs,true);
PluginData.getMessageUtil().sendInfoMessage(cs, "Automatic RP switching enabled. RP switched to '"
+rpRegion.getRp()+"'.");
}
return true;
}
case "px" -> {
if (args.length < 2) {
PluginData.getMessageUtil().sendNotEnoughArgumentsError(cs);
return true;
}
if(!NumericUtil.isInt(args[1])) {
if (!NumericUtil.isInt(args[1])) {
PluginData.getMessageUtil().sendErrorMessage(cs, "You need to specify resolution in px. If your resolution is not available for a RP you'll see default resolution.");
return true;
}
int px = NumericUtil.getInt(args[1]);
if(!RpManager.searchRpKey(RpManager.getResolutionKey(px))) {
if (!RpManager.searchRpKey(RpManager.getResolutionKey(px))) {
PluginData.getMessageUtil().sendErrorMessage(cs, "That resolution is not available, try 16 or 32.");
return true;
}
data.setResolution(px);
PluginData.getMessageUtil().sendInfoMessage(cs, "RP resolution set to "
+ccStressed+px+"px"+ccInfo+". If this resolution is not available for a RP you'll see default resolution.");
break;
case "variant":
if(args.length<2) {
+ ccStressed + px + "px" + ccInfo + ". If this resolution is not available for a RP you'll see default resolution.");
}
case "variant" -> {
if (args.length < 2) {
PluginData.getMessageUtil().sendNotEnoughArgumentsError(cs);
return true;
}
if(args[1].startsWith("xxx_") || !RpManager.searchRpKey(args[1])) {
if (args[1].startsWith("xxx_") || !RpManager.searchRpKey(args[1])) {
PluginData.getMessageUtil().sendErrorMessage(cs, "That variant is not available. Try 'light' or 'dark'.");
return true;
}
if(data.getVariant().equals(args[1])) {
PluginData.getMessageUtil().sendErrorMessage(cs, "You are already using variant "+args[1]);
if (data.getVariant().equals(args[1])) {
PluginData.getMessageUtil().sendErrorMessage(cs, "You are already using variant " + args[1]);
return true;
}
data.setVariant(args[1]);
RpManager.setRp(RpManager.getRpForUrl(data.getCurrentRpUrl()),(Player)cs,true);
RpManager.setRp(RpManager.getRpForUrl(data.getCurrentRpUrl()), (Player) cs, true);
PluginData.getMessageUtil().sendInfoMessage(cs, "RP variant set to "
+ccStressed+args[1]+ccInfo+". If this variant is not available for a RP you'll see default variant.");
break;
case "client":
if(args.length<2 ) {
+ ccStressed + args[1] + ccInfo + ". If this variant is not available for a RP you'll see default variant.");
}
case "client" -> {
if (args.length < 2) {
PluginData.getMessageUtil().sendNotEnoughArgumentsError(cs);
return true;
}
if(args[1].startsWith("xxx_") || !RpManager.searchRpKey(args[1])) {
if (args[1].startsWith("xxx_") || !RpManager.searchRpKey(args[1])) {
PluginData.getMessageUtil().sendErrorMessage(cs, "That client type is not available. Try 'vanilla' or 'sodium'.");
return true;
}
if(data.getClient().equals(args[1])) {
PluginData.getMessageUtil().sendErrorMessage(cs, "You have already set your client type to "+args[1]);
if (data.getClient().equals(args[1])) {
PluginData.getMessageUtil().sendErrorMessage(cs, "You have already set your client type to " + args[1]);
return true;
}
data.setClient(args[1]);
RpManager.setRp(RpManager.getRpForUrl(data.getCurrentRpUrl()),(Player)cs,true);
RpManager.setRp(RpManager.getRpForUrl(data.getCurrentRpUrl()), (Player) cs, true);
PluginData.getMessageUtil().sendInfoMessage(cs, "client type set to "
+ccStressed+args[1]+ccInfo+". If there is no rp for this client type available you'll get the rp for vanilla clients.");
break;
+ ccStressed + args[1] + ccInfo + ". If there is no rp for this client type available you'll get the rp for vanilla clients.");
}
}
RpManager.savePlayerData((Player)cs);
if((data.isAutoRp() || !args[0].equalsIgnoreCase("auto"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void setServerResourcePack(CommandSender cs, String rpName, String
rpConfig.set("sodium.16px.footprints.url", download + version + "/"+finalRpName+"-Sodium-Footprints.zip");
} else {
rpConfig.set("vanilla.16px.light.url", download + version + "/"+finalRpName+".zip");
rpConfig.set("vanilla.16px.footprints.url", download + version + "/"+finalRpName+"-footprints.zip");
rpConfig.set("vanilla.16px.footprints.url", download + version + "/"+finalRpName+"-Footprints.zip");
}
ArchitectPlugin.getPluginInstance().saveConfig();
//ArchitectPlugin.getPluginInstance().loadData(); probably not needed
Expand Down

0 comments on commit 68cb2c3

Please sign in to comment.