Fixed problems with permissions of ws.get and ws.sethome
This commit is contained in:
parent
8a0081e725
commit
3b63d92741
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.butzlabben.world</groupId>
|
||||
<artifactId>WorldSystem</artifactId>
|
||||
<version>2.4.2.1</version>
|
||||
<version>2.4.2.2</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.number>-</project.build.number>
|
||||
|
|
|
@ -1,83 +1,84 @@
|
|||
package de.butzlabben.autoupdater;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import de.butzlabben.world.WorldSystem;
|
||||
|
||||
/**
|
||||
* @author Butzlabben
|
||||
* @since 02.05.2018
|
||||
*/
|
||||
public class UpdateInformations {
|
||||
|
||||
private final String version, url, plugin;
|
||||
private final boolean silent;
|
||||
private final String version, url, plugin;
|
||||
private final boolean silent;
|
||||
|
||||
public static synchronized UpdateInformations getInformations() {
|
||||
String json = callURL("https://zendilu.net/butzlabben/worldsystem/info.php?version=" + WorldSystem.getInstance().getDescription().getVersion());
|
||||
Gson gson = new GsonBuilder().create();
|
||||
UpdateInformations ui = gson.fromJson(json, UpdateInformations.class);
|
||||
return ui;
|
||||
}
|
||||
public static synchronized UpdateInformations getInformations() {
|
||||
String json = callURL("https://zendilu.net/butzlabben/worldsystem/info.php?version=" + WorldSystem.getInstance().getDescription().getVersion());
|
||||
System.out.println("JSON: " + json);
|
||||
Gson gson = new GsonBuilder().create();
|
||||
UpdateInformations ui = gson.fromJson(json, UpdateInformations.class);
|
||||
return ui;
|
||||
}
|
||||
|
||||
public static String callURL(String URL) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
URLConnection urlConn = null;
|
||||
InputStreamReader in = null;
|
||||
try {
|
||||
URL url = new URL(URL);
|
||||
urlConn = url.openConnection();
|
||||
public static String callURL(String URL) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
URLConnection urlConn = null;
|
||||
InputStreamReader in = null;
|
||||
try {
|
||||
URL url = new URL(URL);
|
||||
urlConn = url.openConnection();
|
||||
|
||||
if (urlConn != null)
|
||||
urlConn.setReadTimeout(60 * 1000);
|
||||
if (urlConn != null)
|
||||
urlConn.setReadTimeout(60 * 1000);
|
||||
|
||||
if (urlConn != null && urlConn.getInputStream() != null) {
|
||||
in = new InputStreamReader(urlConn.getInputStream(), Charset.defaultCharset());
|
||||
BufferedReader bufferedReader = new BufferedReader(in);
|
||||
if (urlConn != null && urlConn.getInputStream() != null) {
|
||||
in = new InputStreamReader(urlConn.getInputStream(), Charset.defaultCharset());
|
||||
BufferedReader bufferedReader = new BufferedReader(in);
|
||||
|
||||
if (bufferedReader != null) {
|
||||
int cp;
|
||||
while ((cp = bufferedReader.read()) != -1) {
|
||||
sb.append((char) cp);
|
||||
}
|
||||
bufferedReader.close();
|
||||
}
|
||||
}
|
||||
if (bufferedReader != null) {
|
||||
int cp;
|
||||
while ((cp = bufferedReader.read()) != -1) {
|
||||
sb.append((char) cp);
|
||||
}
|
||||
bufferedReader.close();
|
||||
}
|
||||
}
|
||||
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getURL() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public boolean isSilent() {
|
||||
return silent;
|
||||
}
|
||||
public String getURL() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public UpdateInformations(String version, String url, String plugin, boolean silent) {
|
||||
this.version = version;
|
||||
this.url = url;
|
||||
this.plugin = plugin;
|
||||
this.silent = silent;
|
||||
}
|
||||
public String getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public boolean isSilent() {
|
||||
return silent;
|
||||
}
|
||||
|
||||
public UpdateInformations(String version, String url, String plugin, boolean silent) {
|
||||
this.version = version;
|
||||
this.url = url;
|
||||
this.plugin = plugin;
|
||||
this.silent = silent;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,8 @@ public class WorldSystem extends JavaPlugin {
|
|||
|
||||
//COMMANDS
|
||||
framework = new CommandFramework(this);
|
||||
framework.setNoPermissionMessage(MessageConfig.getNoPermission());
|
||||
|
||||
framework.registerCommands(new WSCommand());
|
||||
framework.registerCommands(new WorldSettingsCommands());
|
||||
framework.registerCommands(new WorldAdministrateCommand());
|
||||
|
|
|
@ -76,6 +76,11 @@ public class WSCommand {
|
|||
return;
|
||||
}
|
||||
|
||||
if(!p.hasPermission("ws.get")) {
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
|
||||
if (PluginConfig.isMultiChoose()) {
|
||||
if (args.length() > 0) {
|
||||
String key = args.getArgument(0);
|
||||
|
|
|
@ -120,6 +120,12 @@ public class WorldSettingsCommands {
|
|||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
|
||||
if(!p.hasPermission("ws.sethome")) {
|
||||
p.sendMessage(MessageConfig.getNoPermission());
|
||||
return;
|
||||
}
|
||||
|
||||
WorldConfig config = WorldConfig.getWorldConfig(p.getWorld().getName());
|
||||
config.setHome(p.getLocation());
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue