mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-23 02:55:47 +01:00
Added ability to add preset random deleports. Versionpush to 1.5.0 dev
This commit is contained in:
parent
a6f6fa29db
commit
6d4731ac5c
14
RandomTeleport v1.0/config.yml
Normal file
14
RandomTeleport v1.0/config.yml
Normal file
@ -0,0 +1,14 @@
|
||||
# Triggered when you use /rtp without any additional paramters
|
||||
# Just write your command as you would use it ingame here
|
||||
# Don't use the -p parameter, this will get added automaticly with the senders name/the specified playername
|
||||
presets:
|
||||
default: "/rtp 100 1000"
|
||||
# add more to use /rtp <rtpname>, player needs "randomteleport.default.<rtpname>"
|
||||
# <rtpname>: "/rtp 1 2"
|
||||
|
||||
msg:
|
||||
search: "§7RandomTeleport searches for a safe place in world {worldname}. . ."
|
||||
teleport: "§7RandomTeleport teleported you to"
|
||||
error:
|
||||
location: "§4Error: §cRandomTeleport could not find a save location!"
|
||||
cooldown: "§cYou have to wait {cooldown_text}before using this RandomTeleport again!"
|
@ -1,7 +1,7 @@
|
||||
name: RandomTeleport
|
||||
main: de.themoep.bukkit.plugin.RandomTeleport.RandomTeleport
|
||||
softdepend: [WorldGuard,Factions]
|
||||
version: 1.4.11
|
||||
version: 1.5.0 dev
|
||||
description: provides a command to teleport the player to a random save location
|
||||
author: Phoenix616
|
||||
website: http://dev.bukkit.org/bukkit-plugins/randomteleport/
|
||||
@ -35,4 +35,7 @@ permissions:
|
||||
default: op
|
||||
randomteleport.stat:
|
||||
description: Permission for showing the teleport statistic
|
||||
default: op
|
||||
randomteleport.presets.default:
|
||||
description: Gives permission to use the default random teleport
|
||||
default: op
|
@ -27,6 +27,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.text.BreakIterator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
@ -114,6 +115,12 @@ public class RandomTeleport extends JavaPlugin implements CommandExecutor {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void onEnable() {
|
||||
saveDefaultConfig();
|
||||
RandomTeleport.textsearch = this.getConfig().getString("msg.search");
|
||||
RandomTeleport.textteleport = this.getConfig().getString("msg.teleport");
|
||||
RandomTeleport.textlocationerror = this.getConfig().getString("msg.error.location");
|
||||
RandomTeleport.textcooldownerror = this.getConfig().getString("msg.error.cooldown");
|
||||
|
||||
cooldown = (HashMap<String, Long>) readMap("cooldown.map");
|
||||
}
|
||||
|
||||
@ -133,7 +140,28 @@ public class RandomTeleport extends JavaPlugin implements CommandExecutor {
|
||||
int cooldowntime = 0;
|
||||
World world = null;
|
||||
|
||||
if(args.length == 0 && sender.hasPermission("randomteleport.presets.default")) {
|
||||
if(this.getConfig().getString("presets.default") != null) {
|
||||
String defaultcmd = this.getConfig().getString("presets.default").replace("/", "");
|
||||
defaultcmd = defaultcmd + " -p " + sender.getName();
|
||||
this.getServer().dispatchCommand(this.getServer().getConsoleSender(),defaultcmd);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(args.length == 1) {
|
||||
if(sender.hasPermission("randomteleport.presets." + args[0].toLowerCase())) {
|
||||
if(this.getConfig().getString("presets." + args[0].toLowerCase()) == null) {
|
||||
sender.sendMessage(ChatColor.RED + "The Random Teleport " + args[0].toLowerCase() + " does not exist!");
|
||||
return true;
|
||||
}
|
||||
String defaultcmd = this.getConfig().getString("presets." + args[0].toLowerCase()).replace("/", "");
|
||||
defaultcmd = defaultcmd + " -p " + sender.getName();
|
||||
this.getServer().dispatchCommand(this.getServer().getConsoleSender(),defaultcmd);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// analyze the args & get parameter
|
||||
if(args.length == 1 && args[0].equalsIgnoreCase("stat") && sender.hasPermission("randomteleport.stat")) {
|
||||
|
Loading…
Reference in New Issue
Block a user