mirror of
https://e.coding.net/circlecloud/TeleportRandom.git
synced 2024-12-26 16:38:49 +00:00
rebuild priject...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
52472fbf80
commit
23bb21d8d7
@ -17,12 +17,12 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor {
|
|||||||
public String servername;
|
public String servername;
|
||||||
public String pluginname;
|
public String pluginname;
|
||||||
|
|
||||||
public void onLoad() {
|
public String getmessage(String path) {
|
||||||
Config.load(this, "1.0");
|
String message = Config.getMessage(path).replaceAll("&", "§");
|
||||||
servername = getmessage("servername");
|
return message;
|
||||||
pluginname = getmessage("pluginname");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String string,
|
public boolean onCommand(CommandSender sender, Command cmd, String string,
|
||||||
String[] args) {
|
String[] args) {
|
||||||
if (cmd.getName().equalsIgnoreCase("tpr")) {
|
if (cmd.getName().equalsIgnoreCase("tpr")) {
|
||||||
@ -50,6 +50,13 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad() {
|
||||||
|
Config.load(this, "1.0");
|
||||||
|
servername = getmessage("servername");
|
||||||
|
pluginname = getmessage("pluginname");
|
||||||
|
}
|
||||||
|
|
||||||
public void RandomTP(String[] limit, Player p) {
|
public void RandomTP(String[] limit, Player p) {
|
||||||
Random rr = new Random();
|
Random rr = new Random();
|
||||||
int lr = Config.getInstance().getInt("default");
|
int lr = Config.getInstance().getInt("default");
|
||||||
@ -92,11 +99,12 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor {
|
|||||||
p.sendMessage(servername + pluginname
|
p.sendMessage(servername + pluginname
|
||||||
+ getmessage("Message.Protect"));
|
+ getmessage("Message.Protect"));
|
||||||
this.getServer().getScheduler()
|
this.getServer().getScheduler()
|
||||||
.runTaskLater(this, new Runnable() {
|
.runTaskLater(this, new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
trl.getBlock().setType(rbm);
|
public void run() {
|
||||||
}
|
trl.getBlock().setType(rbm);
|
||||||
}, 200);
|
}
|
||||||
|
}, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Location nrl = new Location(world, x, y + 3, z);
|
Location nrl = new Location(world, x, y + 3, z);
|
||||||
@ -104,12 +112,7 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor {
|
|||||||
p.sendMessage(servername
|
p.sendMessage(servername
|
||||||
+ pluginname
|
+ pluginname
|
||||||
+ getmessage("Message.Tip")
|
+ getmessage("Message.Tip")
|
||||||
.replaceAll("%world%", world.getName())
|
.replaceAll("%world%", world.getName())
|
||||||
.replaceAll("%x%", x + "").replaceAll("%z%", z + ""));
|
.replaceAll("%x%", x + "").replaceAll("%z%", z + ""));
|
||||||
}
|
|
||||||
|
|
||||||
public String getmessage(String path) {
|
|
||||||
String message = Config.getMessage(path).replaceAll("&", "§");
|
|
||||||
return message;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,9 @@ import com.google.common.io.Files;
|
|||||||
*/
|
*/
|
||||||
public class FileConfig extends YamlConfiguration {
|
public class FileConfig extends YamlConfiguration {
|
||||||
|
|
||||||
protected final DumperOptions yamlOptions = new DumperOptions();
|
|
||||||
protected final Representer yamlRepresenter = new YamlRepresenter();
|
|
||||||
protected final Yaml yaml = new Yaml(new YamlConstructor(),
|
|
||||||
yamlRepresenter, yamlOptions);
|
|
||||||
|
|
||||||
public static FileConfig init(File file) {
|
public static FileConfig init(File file) {
|
||||||
return FileConfig.loadConfiguration(file);
|
return FileConfig.loadConfiguration(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FileConfig loadConfiguration(File file) {
|
public static FileConfig loadConfiguration(File file) {
|
||||||
Validate.notNull(file, "File cannot be null");
|
Validate.notNull(file, "File cannot be null");
|
||||||
FileConfig config = new FileConfig();
|
FileConfig config = new FileConfig();
|
||||||
@ -52,6 +46,34 @@ public class FileConfig extends YamlConfiguration {
|
|||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
protected final DumperOptions yamlOptions = new DumperOptions();
|
||||||
|
|
||||||
|
protected final Representer yamlRepresenter = new YamlRepresenter();
|
||||||
|
|
||||||
|
protected final Yaml yaml = new Yaml(new YamlConstructor(),
|
||||||
|
yamlRepresenter, yamlOptions);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(File file) throws FileNotFoundException, IOException,
|
||||||
|
InvalidConfigurationException {
|
||||||
|
Validate.notNull(file, "File cannot be null");
|
||||||
|
final FileInputStream stream = new FileInputStream(file);
|
||||||
|
load(new InputStreamReader(stream, Charsets.UTF_8));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(File file) throws IOException {
|
||||||
|
Validate.notNull(file, "File cannot be null");
|
||||||
|
Files.createParentDirs(file);
|
||||||
|
String data = saveToString();
|
||||||
|
Writer writer = new OutputStreamWriter(new FileOutputStream(file),
|
||||||
|
Charsets.UTF_8);
|
||||||
|
try {
|
||||||
|
writer.write(data);
|
||||||
|
} finally {
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String saveToString() {
|
public String saveToString() {
|
||||||
@ -65,24 +87,4 @@ public class FileConfig extends YamlConfiguration {
|
|||||||
}
|
}
|
||||||
return header + dump;
|
return header + dump;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(File file) throws FileNotFoundException, IOException,
|
|
||||||
InvalidConfigurationException {
|
|
||||||
Validate.notNull(file, "File cannot be null");
|
|
||||||
final FileInputStream stream = new FileInputStream(file);
|
|
||||||
load(new InputStreamReader(stream, Charsets.UTF_8));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save(File file) throws IOException {
|
|
||||||
Validate.notNull(file, "File cannot be null");
|
|
||||||
Files.createParentDirs(file);
|
|
||||||
String data = saveToString();
|
|
||||||
Writer writer = new OutputStreamWriter(new FileOutputStream(file),
|
|
||||||
Charsets.UTF_8);
|
|
||||||
try {
|
|
||||||
writer.write(data);
|
|
||||||
} finally {
|
|
||||||
writer.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user