Les joueurs peuvent maintenant gérer l'appartenance des animaux domestiquable avec /animal
This commit is contained in:
parent
d6ee50816c
commit
1fcfea8f83
@ -7,7 +7,7 @@
|
|||||||
<attribute name="javadoc_location" value="http://jd.bukkit.org/beta/apidocs/"/>
|
<attribute name="javadoc_location" value="http://jd.bukkit.org/beta/apidocs/"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="lib" path="lib/craftbukkit-1.7.2-R0.3.jar"/>
|
<classpathentry kind="lib" path="lib/craftbukkit-1.7.2-R0.3.jar" sourcepath="lib/craftbukkit-1.7.2-R0.3.src.zip"/>
|
||||||
<classpathentry kind="lib" path="lib/fanciful-0.1.5.jar"/>
|
<classpathentry kind="lib" path="lib/fanciful-0.1.5.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/ProtocolLib-3.2.0.jar"/>
|
<classpathentry kind="lib" path="lib/ProtocolLib-3.2.0.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/WorldEdit-5.6.jar"/>
|
<classpathentry kind="lib" path="lib/WorldEdit-5.6.jar"/>
|
||||||
|
BIN
lib/craftbukkit-1.7.2-R0.3.src.zip
Normal file
BIN
lib/craftbukkit-1.7.2-R0.3.src.zip
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<jardesc>
|
<jardesc>
|
||||||
<jar path="PandacraftUtils/jar_export/PandacraftUtils-3.8.jar"/>
|
<jar path="PandacraftUtils/jar_export/PandacraftUtils-3.9.jar"/>
|
||||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/PandacraftUtils/make_jar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
<options buildIfNeeded="true" compress="true" descriptionLocation="/PandacraftUtils/make_jar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||||
<selectedProjects/>
|
<selectedProjects/>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: PandacraftUtils
|
name: PandacraftUtils
|
||||||
main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils
|
main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils
|
||||||
version: 3.8
|
version: 3.9
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -69,6 +69,10 @@ commands:
|
|||||||
description: Administration
|
description: Administration
|
||||||
usage: /admin [reload [config|network]]
|
usage: /admin [reload [config|network]]
|
||||||
permission: pandacraft.admin
|
permission: pandacraft.admin
|
||||||
|
animal:
|
||||||
|
description: Gestion des propriétaire des animaux apprivoisable
|
||||||
|
usage: /animal [donner <Pseudo>]
|
||||||
|
permission: pandacraft.animal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -145,6 +149,15 @@ permissions:
|
|||||||
pandacraft.admin:
|
pandacraft.admin:
|
||||||
description: Utiliser la commande admin
|
description: Utiliser la commande admin
|
||||||
default: op
|
default: op
|
||||||
|
|
||||||
|
#### à ajouter
|
||||||
|
pandacraft.animal:
|
||||||
|
description: Utiliser la commande animal
|
||||||
|
default: true
|
||||||
|
#### à ajouter
|
||||||
|
pandacraft.animal.admin:
|
||||||
|
description: Utiliser la commande animal pour tout les animaux
|
||||||
|
default: op
|
||||||
|
|
||||||
|
|
||||||
pandacraft.antispam.exempt:
|
pandacraft.antispam.exempt:
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package net.mc_pandacraft.java.plugin.pandacraftutils.commands;
|
||||||
|
|
||||||
|
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayer;
|
||||||
|
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Tameable;
|
||||||
|
|
||||||
|
public class CommandAnimal extends AbstractCommandExecutor {
|
||||||
|
|
||||||
|
public CommandAnimal() {
|
||||||
|
super("animal");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String label,
|
||||||
|
String[] args) {
|
||||||
|
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage(ChatColor.RED+"seul un joueur en ligne peut effectuer cette commande");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = (Player) sender;
|
||||||
|
OnlinePlayer op = OnlinePlayerManager.get(p);
|
||||||
|
|
||||||
|
if (!op.isAnimalSelectionEnabled()) {
|
||||||
|
op.enableAnimalSelection();
|
||||||
|
p.sendMessage(ChatColor.GREEN+"Faites clic droite pour sélectionner un animal apprivoisé");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// la sélection d'un animal est déjà activée
|
||||||
|
|
||||||
|
// si je joueur n'a pas encore sélectionné d'animal
|
||||||
|
if (op.getSelectedAnimal() == null) {
|
||||||
|
p.sendMessage(ChatColor.RED+"Faites d'abord un clic droite sur un animal apprivoisé");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tameable animal = op.getSelectedAnimal();
|
||||||
|
|
||||||
|
if ((animal.getOwner() == null || !animal.getOwner().equals(p)) && !op.hasPermission("pandacraft.animal.admin")) {
|
||||||
|
p.sendMessage(ChatColor.RED+"Vous n'avez pas le droit de modifier cet animal");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (args.length >= 2 && args[0].equalsIgnoreCase("donner")) {
|
||||||
|
|
||||||
|
Player newOwner = plugin.getServer().getPlayer(args[1]);
|
||||||
|
|
||||||
|
if (newOwner == null) {
|
||||||
|
p.sendMessage(ChatColor.RED+"Le joueur indiqué n'est pas en ligne");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
animal.setOwner(newOwner);
|
||||||
|
p.sendMessage(ChatColor.GREEN+"Vous venez de donner cet animal à "+newOwner.getDisplayName());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -52,6 +52,7 @@ public class CommandsManager {
|
|||||||
add(new CommandSetblock());
|
add(new CommandSetblock());
|
||||||
add(new CommandStaff());
|
add(new CommandStaff());
|
||||||
add(new CommandSystem());
|
add(new CommandSystem());
|
||||||
|
add(new CommandAnimal());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.mc_pandacraft.java.plugin.pandacraftutils.modules.cheat_protect;
|
package net.mc_pandacraft.java.plugin.pandacraftutils.modules.cheat_protect;
|
||||||
|
|
||||||
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
|
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
|
||||||
|
import net.mc_pandacraft.java.plugin.pandacraftutils.players.OnlinePlayerManager;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.AnimalTamer;
|
import org.bukkit.entity.AnimalTamer;
|
||||||
@ -54,7 +55,7 @@ public class TamedEntityProtectManager implements Listener {
|
|||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Player p = (Player) event.getEntered();
|
Player p = (Player) event.getEntered();
|
||||||
p.sendMessage(ChatColor.RED+"Cet animal est à "+getOwnerDisplayName(tameableEntity)+", vous ne pouvez pas y toucher");
|
p.sendMessage(ChatColor.RED+"Cet animal est à "+getOwnerDisplayName(tameableEntity)+ChatColor.RED+", vous ne pouvez pas y toucher");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -72,7 +73,7 @@ public class TamedEntityProtectManager implements Listener {
|
|||||||
if (animal.getOwner().equals(p)) return;
|
if (animal.getOwner().equals(p)) return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
p.sendMessage(ChatColor.RED+"Cet animal est à "+getOwnerDisplayName(animal)+", vous ne pouvez pas y toucher");
|
p.sendMessage(ChatColor.RED+"Cet animal est à "+getOwnerDisplayName(animal)+ChatColor.RED+", vous ne pouvez pas y toucher");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,10 +87,15 @@ public class TamedEntityProtectManager implements Listener {
|
|||||||
|
|
||||||
Tameable animal = (Tameable) event.getRightClicked();
|
Tameable animal = (Tameable) event.getRightClicked();
|
||||||
|
|
||||||
|
boolean selected = OnlinePlayerManager.get(event.getPlayer()).setSelectedAnimal(animal);
|
||||||
|
if (selected) {
|
||||||
|
event.getPlayer().sendMessage(ChatColor.GREEN+"Vous venez de sélectionner cet animal");
|
||||||
|
}
|
||||||
|
|
||||||
if (animal.getOwner().equals(event.getPlayer())) return;
|
if (animal.getOwner().equals(event.getPlayer())) return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.getPlayer().sendMessage(ChatColor.RED+"Cet animal est à "+getOwnerDisplayName(animal)+", vous ne pouvez pas y toucher");
|
event.getPlayer().sendMessage(ChatColor.RED+"Cet animal est à "+getOwnerDisplayName(animal)+ChatColor.RED+", vous ne pouvez pas y toucher");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface.Essentials
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Tameable;
|
||||||
|
|
||||||
import ru.tehkode.permissions.bukkit.PermissionsEx;
|
import ru.tehkode.permissions.bukkit.PermissionsEx;
|
||||||
|
|
||||||
@ -228,6 +229,43 @@ public class OnlinePlayer {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sélection d'un animal aprivoisé
|
||||||
|
*/
|
||||||
|
|
||||||
|
private Tameable selectedAnimal = null;
|
||||||
|
private boolean enableAnimalSelection = false;
|
||||||
|
|
||||||
|
public void enableAnimalSelection() { enableAnimalSelection = true; }
|
||||||
|
|
||||||
|
public boolean setSelectedAnimal(Tameable animal) {
|
||||||
|
if (!enableAnimalSelection || animal == null) return false;
|
||||||
|
selectedAnimal = animal;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tameable getSelectedAnimal() { return selectedAnimal; }
|
||||||
|
public boolean isAnimalSelectionEnabled() { return enableAnimalSelection; }
|
||||||
|
|
||||||
|
public void resetAnimalSelection() {
|
||||||
|
selectedAnimal = null;
|
||||||
|
enableAnimalSelection = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user