Première version
This commit is contained in:
parent
2b7fc71c8b
commit
a63b11b741
9
Menoria/.classpath
Normal file
9
Menoria/.classpath
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="lib" path="F:/serveurs minecraft/spigot/server.jar"/>
|
||||
<classpathentry kind="lib" path="F:/serveurs minecraft/spigot/plugins/Jobs3.5.6.jar"/>
|
||||
<classpathentry kind="lib" path="F:/serveurs minecraft/spigot/plugins/Vault.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
Menoria/.project
Normal file
17
Menoria/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Menoria</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
11
Menoria/.settings/org.eclipse.jdt.core.prefs
Normal file
11
Menoria/.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,11 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
BIN
Menoria/bin/net/DeltaWings/Nemoria/API/MinecraftToJSON.class
Normal file
BIN
Menoria/bin/net/DeltaWings/Nemoria/API/MinecraftToJSON.class
Normal file
Binary file not shown.
BIN
Menoria/bin/net/DeltaWings/Nemoria/Commands/PlayerInfos.class
Normal file
BIN
Menoria/bin/net/DeltaWings/Nemoria/Commands/PlayerInfos.class
Normal file
Binary file not shown.
BIN
Menoria/bin/net/DeltaWings/Nemoria/Listeners/ChatListener.class
Normal file
BIN
Menoria/bin/net/DeltaWings/Nemoria/Listeners/ChatListener.class
Normal file
Binary file not shown.
BIN
Menoria/bin/net/DeltaWings/Nemoria/Main.class
Normal file
BIN
Menoria/bin/net/DeltaWings/Nemoria/Main.class
Normal file
Binary file not shown.
42
Menoria/plugin.yml
Normal file
42
Menoria/plugin.yml
Normal file
@ -0,0 +1,42 @@
|
||||
name: Nemoria-Plugin
|
||||
version: 1.0.0
|
||||
main: net.DeltaWings.Nemoria.Main
|
||||
author: Aviortheking
|
||||
depend: [Vault, Jobs]
|
||||
commands:
|
||||
playerinfos:
|
||||
aliases: [pi, pinfos]
|
||||
permissions:
|
||||
delta.pi.prefix.color.black:
|
||||
default: false
|
||||
delta.pi.prefix.color.dark_blue:
|
||||
default: false
|
||||
delta.pi.prefix.color.dark_aqua:
|
||||
default: false
|
||||
delta.pi.prefix.color.dark_red:
|
||||
default: false
|
||||
delta.pi.prefix.color.dark_purple:
|
||||
default: false
|
||||
delta.pi.prefix.color.gold:
|
||||
default: false
|
||||
delta.pi.prefix.color.gray:
|
||||
default: false
|
||||
delta.pi.prefix.color.dark_gray:
|
||||
default: false
|
||||
delta.pi.prefix.color.blue:
|
||||
default: false
|
||||
delta.pi.prefix.color.green:
|
||||
default: false
|
||||
delta.pi.prefix.color.aqua:
|
||||
default: false
|
||||
delta.pi.prefix.color.red:
|
||||
default: false
|
||||
delta.pi.prefix.color.light_purple:
|
||||
default: false
|
||||
delta.pi.prefix.color.yellow:
|
||||
default: false
|
||||
delta.pi.prefix.color.white:
|
||||
default: false
|
||||
delta.pi.color:
|
||||
default: false
|
||||
|
145
Menoria/src/net/DeltaWings/Nemoria/API/MinecraftToJSON.java
Normal file
145
Menoria/src/net/DeltaWings/Nemoria/API/MinecraftToJSON.java
Normal file
@ -0,0 +1,145 @@
|
||||
package net.DeltaWings.Nemoria.API;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MinecraftToJSON {
|
||||
|
||||
public static String colors(String color){
|
||||
if(color.equalsIgnoreCase("0")) return "black";
|
||||
if(color.equalsIgnoreCase("1")) return "dark_blue";
|
||||
if(color.equalsIgnoreCase("2")) return "dark_green";
|
||||
if(color.equalsIgnoreCase("3")) return "dark_aqua";
|
||||
if(color.equalsIgnoreCase("4")) return "dark_red";
|
||||
if(color.equalsIgnoreCase("5")) return "dark_purple";
|
||||
if(color.equalsIgnoreCase("6")) return "gold";
|
||||
if(color.equalsIgnoreCase("7")) return "gray";
|
||||
if(color.equalsIgnoreCase("8")) return "dark_gray";
|
||||
if(color.equalsIgnoreCase("9")) return "blue";
|
||||
if(color.equalsIgnoreCase("a")) return "green";
|
||||
if(color.equalsIgnoreCase("b")) return "aqua";
|
||||
if(color.equalsIgnoreCase("c")) return "red";
|
||||
if(color.equalsIgnoreCase("d")) return "light_purple";
|
||||
if(color.equalsIgnoreCase("e")) return "yellow";
|
||||
if(color.equalsIgnoreCase("f")) return "white";
|
||||
return "none";
|
||||
}
|
||||
|
||||
public static String special(String code){
|
||||
if(code.equalsIgnoreCase("k")) return "obfuscated";
|
||||
if(code.equalsIgnoreCase("l")) return "bold";
|
||||
if(code.equalsIgnoreCase("m")) return "strikethrough";
|
||||
if(code.equalsIgnoreCase("n")) return "underline";
|
||||
if(code.equalsIgnoreCase("o")) return "italic";
|
||||
if(code.equalsIgnoreCase("r")) return "reset";
|
||||
return "none";
|
||||
}
|
||||
|
||||
public static String main(String string, Player player){
|
||||
//split de la phrase en lettres
|
||||
String[] parts = string.split("");
|
||||
//set result
|
||||
List<String> result = new ArrayList<String>();;
|
||||
//set couleur de base
|
||||
String color = ",\"color\":\"white\"";
|
||||
//set specials de base
|
||||
String[] special = {
|
||||
",\"bold\":false",
|
||||
",\"italic\":false",
|
||||
",\"strikethrough\":false",
|
||||
",\"underlined\":false",
|
||||
",\"obfuscated\":false",
|
||||
};
|
||||
Boolean yolo = false;
|
||||
String one = "";
|
||||
/*
|
||||
* for nombre de lettre de la phrase
|
||||
* si yolo = true
|
||||
* check si lettre est dans liste
|
||||
* si oui
|
||||
* on vire la lettre et on ferme le truc actuel
|
||||
* check si c'est une couleur
|
||||
* check si c'est un special
|
||||
* on en reouvre un autre
|
||||
* si non
|
||||
* on remet le &
|
||||
* set yolo = false
|
||||
* si lettre actuel = &
|
||||
* set yolo true
|
||||
* sinon
|
||||
* ont les mets les une a cotés des autre
|
||||
*/
|
||||
for(int a=0;a<parts.length;a++){
|
||||
if( yolo == true){
|
||||
if(special(parts[a]) != "none" || colors(parts[a]) != "none"){
|
||||
result.add("{\"text\":\""+one+"\""+color+special[0]+special[1]+special[2]+special[3]+special[4]+"}");
|
||||
if(special(parts[a]) != "none" && player.hasPermission("delta.pi.color")){
|
||||
if(special(parts[a]) == "bold") special[0] = ",\"bold\":true";
|
||||
if(special(parts[a]) == "italic") special[1] = ",\"italic\":true";
|
||||
if(special(parts[a]) == "strikethrough") special[2] = ",\"strikethrough\":true";
|
||||
if(special(parts[a]) == "underlined") special[3] = ",\"underlined\":true";
|
||||
if(special(parts[a]) == "obfuscated") special[4] = ",\"obfuscated\":true";
|
||||
if(special(parts[a]) == "reset"){
|
||||
color = ",\"color\":\"white\"";
|
||||
special[0] = ",\"bold\":false";
|
||||
special[1] = ",\"italic\":false";
|
||||
special[2] = ",\"strikethrough\":false";
|
||||
special[3] = ",\"underlined\":false";
|
||||
special[4] = ",\"obfuscated\":false";
|
||||
}
|
||||
}else if(colors(parts[a]) != "none" && player.hasPermission("delta.pi.color")) color = ",\"color\":\""+colors(parts[a])+"\"";
|
||||
parts[a] = "";
|
||||
one = "";
|
||||
}else{
|
||||
one+= "&";
|
||||
}
|
||||
yolo = false;
|
||||
}
|
||||
if(parts[a].equals("&")){
|
||||
yolo = true;
|
||||
}else{
|
||||
if(parts[a].equals("\"")) one += "\\\"";
|
||||
else if(parts[a].equals("\'")) one += "\\\'";
|
||||
else one+= parts[a];
|
||||
|
||||
}
|
||||
}
|
||||
if(one.length() != 0){
|
||||
result.add("{\"text\":\""+one+"\""+color+special[0]+special[1]+special[2]+special[3]+special[4]+"}");
|
||||
one = "";
|
||||
}
|
||||
String pcolor = "white";
|
||||
String perm = "delta.pi.prefix.color.";
|
||||
if(player.hasPermission(perm+"black")) pcolor = "black";
|
||||
else if(player.hasPermission(perm+"dark_blue")) pcolor = "dark_blue";
|
||||
else if(player.hasPermission(perm+"dark_green")) pcolor = "dark_green";
|
||||
else if(player.hasPermission(perm+"dark_aqua")) pcolor = "dark_aqua";
|
||||
else if(player.hasPermission(perm+"dark_red")) pcolor = "dark_red";
|
||||
else if(player.hasPermission(perm+"dark_purple")) pcolor = "dark_purple";
|
||||
else if(player.hasPermission(perm+"gold")) pcolor = "gold";
|
||||
else if(player.hasPermission(perm+"gray")) pcolor = "gray";
|
||||
else if(player.hasPermission(perm+"dark_gray")) pcolor = "dark_gray";
|
||||
else if(player.hasPermission(perm+"blue")) pcolor = "blue";
|
||||
else if(player.hasPermission(perm+"green")) pcolor = "green";
|
||||
else if(player.hasPermission(perm+"aqua")) pcolor = "aqua";
|
||||
else if(player.hasPermission(perm+"red")) pcolor = "red";
|
||||
else if(player.hasPermission(perm+"light_purple")) pcolor = "light_purple";
|
||||
else if(player.hasPermission(perm+"yellow")) pcolor = "yellow";
|
||||
else if(player.hasPermission(perm+"white")) pcolor = "white";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Changement de result en String avec un prefix et un suffix
|
||||
String end = "[\"\",{\"text\":\"[] \",\"bold\":true,\"color\":\"gold\"},{\"text\":\""+player.getName()+" \",\"color\":\""+pcolor+"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/pi "+player.getName()+"\"}},{\"text\":\"> \",\"bold\":true,\"color\":\"gold\"},";
|
||||
for(int a = 0;a<result.size();a++){
|
||||
if(a != 0) end += ",";
|
||||
end += result.get(a);
|
||||
}
|
||||
end += "]";
|
||||
return end;
|
||||
}
|
||||
}
|
48
Menoria/src/net/DeltaWings/Nemoria/Commands/PlayerInfos.java
Normal file
48
Menoria/src/net/DeltaWings/Nemoria/Commands/PlayerInfos.java
Normal file
@ -0,0 +1,48 @@
|
||||
package net.DeltaWings.Nemoria.Commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
|
||||
import net.DeltaWings.Nemoria.Main;
|
||||
|
||||
|
||||
public class PlayerInfos implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if(sender instanceof Player){
|
||||
Player p = (Player)sender;
|
||||
if(cmd.getName().equalsIgnoreCase("playerinfos")){
|
||||
if(args.length == 1){
|
||||
for(Player player : Bukkit.getServer().getOnlinePlayers()){
|
||||
if(player.getName().equalsIgnoreCase(args[0])){
|
||||
p.sendMessage("§bNom: §6"+player.getName()+"§b\n Vie: §6"+player.getHealth()+"§b\nNiveau: §6"+player.getLevel()+"§b\nExperience: §6"+player.getExp()+"§b\nDollars: §6"+Main.eco.getBalance(player));
|
||||
List<JobProgression> jobs = Jobs.getPlayerManager().getJobsPlayer(player).getJobProgression();
|
||||
for (JobProgression OneJob : jobs) {
|
||||
p.sendMessage("§bJob actuel: §6"+OneJob.getJob().getName()+ "§b Niveau: §6"+OneJob.getLevel()+"§b Experience: §6"+OneJob.getExperience()+"§b/§6"+OneJob.getMaxExperience());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//get money
|
||||
//get job
|
||||
//get job level
|
||||
//say Comtniark et de métier mineur niveaux 13 posséde 50 Crédit et actuellement lv 50(xp du joueur) vie actuel : 10 coeurs
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package net.DeltaWings.Nemoria.Listeners;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
import net.DeltaWings.Nemoria.API.MinecraftToJSON;
|
||||
|
||||
import net.minecraft.server.v1_10_R1.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_10_R1.IChatBaseComponent.ChatSerializer;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayOutChat;
|
||||
|
||||
public class ChatListener implements Listener {
|
||||
|
||||
@EventHandler(priority=EventPriority.HIGHEST)
|
||||
public void onPlayerChat(AsyncPlayerChatEvent e){
|
||||
String msg = MinecraftToJSON.main(e.getMessage(), e.getPlayer());
|
||||
System.out.println(msg);
|
||||
e.setCancelled(true);
|
||||
IChatBaseComponent link = ChatSerializer.a(msg);
|
||||
PacketPlayOutChat packet = new PacketPlayOutChat(link);
|
||||
((CraftPlayer) e.getPlayer()).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
53
Menoria/src/net/DeltaWings/Nemoria/Main.java
Normal file
53
Menoria/src/net/DeltaWings/Nemoria/Main.java
Normal file
@ -0,0 +1,53 @@
|
||||
package net.DeltaWings.Nemoria;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import net.DeltaWings.Nemoria.Commands.PlayerInfos;
|
||||
import net.DeltaWings.Nemoria.Listeners.ChatListener;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
public class Main extends JavaPlugin implements Listener{
|
||||
//creation de l'instance
|
||||
public static Main instance;
|
||||
public static Main getInstance() {
|
||||
return instance;
|
||||
}
|
||||
public static Economy eco = null;
|
||||
|
||||
public void onEnable(){
|
||||
//creation de l'instance
|
||||
instance = this;
|
||||
setupEconomy();
|
||||
//create chatlistener
|
||||
getServer().getPluginManager().registerEvents(new ChatListener(), this);
|
||||
getCommand("PlayerInfos").setExecutor(new PlayerInfos());
|
||||
|
||||
//plugin enabled
|
||||
System.out.println("[Player Imformation]Plugin enabled");
|
||||
}
|
||||
|
||||
public void onDisable(){
|
||||
|
||||
|
||||
//plugin disabled
|
||||
System.out.println("[Player Imformation]Plugin disabled");
|
||||
}
|
||||
private boolean setupEconomy()
|
||||
{
|
||||
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
if (economyProvider != null) {
|
||||
eco = economyProvider.getProvider();
|
||||
}
|
||||
|
||||
return (eco != null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* OBJECTIF:
|
||||
* quand le joueur se trouve a x coordonné dans x monde
|
||||
* ouvrir un chest
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user