On peut maintenant voir la sélection WorldEdit d'un autre joueur (quadrillage de flamme) + ajout d'une fonctionnalité dans le projet permettant d'empaqueter le .jar en quelques clics, avec la config toute faite
This commit is contained in:
parent
f7c9962e89
commit
dd11a55497
@ -2,11 +2,11 @@
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/bukkit-1.7.2-R0.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/craftbukkit-1.7.2-R0.3.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/WorldEdit-5.6.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_67"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
12
.settings/org.eclipse.jdt.core.prefs
Normal file
12
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
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
|
17
make_jar.jardesc
Normal file
17
make_jar.jardesc
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<jardesc>
|
||||
<jar path="PandacraftUtils/jar_export/PandacraftUtils-2.2.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"/>
|
||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||
<selectedProjects/>
|
||||
<manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
|
||||
<sealing sealJar="false">
|
||||
<packagesToSeal/>
|
||||
<packagesToUnSeal/>
|
||||
</sealing>
|
||||
</manifest>
|
||||
<selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
|
||||
<javaElement handleIdentifier="=PandacraftUtils/resources"/>
|
||||
<javaElement handleIdentifier="=PandacraftUtils/src"/>
|
||||
</selectedElements>
|
||||
</jardesc>
|
@ -1,6 +1,6 @@
|
||||
name: PandacraftUtils
|
||||
main: net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils
|
||||
version: 2.1
|
||||
version: 2.2
|
||||
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@ public class ConfigManager {
|
||||
|
||||
public static ConfigManager getInstance() { return instance; }
|
||||
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private PandacraftUtils plugin;
|
||||
|
||||
public ConfigManager(File f, PandacraftUtils pl) {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.survival_cuboid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.protocol.ParticleEffect;
|
||||
@ -28,7 +29,7 @@ public class CommandWandSelection extends BukkitRunnable implements CommandExecu
|
||||
|
||||
private PandacraftUtils plugin;
|
||||
|
||||
private List<Player> players = new LinkedList<Player>();
|
||||
private Map<Player, List<Player>> players = new HashMap<Player, List<Player>>();
|
||||
|
||||
|
||||
|
||||
@ -40,7 +41,8 @@ public class CommandWandSelection extends BukkitRunnable implements CommandExecu
|
||||
plugin.getServer().getScheduler().runTaskTimer(plugin, this, 20L, 20L);
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
|
||||
players.addAll(Arrays.asList(plugin.getServer().getOnlinePlayers()));
|
||||
for (Player p : plugin.getServer().getOnlinePlayers())
|
||||
players.put(p, new ArrayList<Player>());
|
||||
}
|
||||
|
||||
|
||||
@ -69,15 +71,47 @@ public class CommandWandSelection extends BukkitRunnable implements CommandExecu
|
||||
}
|
||||
|
||||
Player p = (Player) sender;
|
||||
if (players.contains(p))
|
||||
|
||||
|
||||
Player otherP = null;
|
||||
if (args.length > 0)
|
||||
{
|
||||
otherP = plugin.getServer().getPlayer(args[0]);
|
||||
if (otherP == null)
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED+"Le joueur indiqué n'existe pas");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (players.containsKey(p) && otherP == null)
|
||||
{ // le joueur ne veut plus voir de cubo
|
||||
players.remove(p);
|
||||
sender.sendMessage(ChatColor.GREEN+"Affichage de la sélection désactivé.");
|
||||
}
|
||||
else if (players.containsKey(p))
|
||||
{
|
||||
if (players.get(p).contains(otherP))
|
||||
{
|
||||
players.get(p).remove(otherP);
|
||||
sender.sendMessage(ChatColor.GREEN+"Affichage de la sélection de "+ChatColor.GRAY+otherP.getName()+ChatColor.GREEN+" désactivé.");
|
||||
}
|
||||
else
|
||||
{
|
||||
players.add(p);
|
||||
players.get(p).add(otherP);
|
||||
sender.sendMessage(ChatColor.GREEN+"Affichage de la sélection de "+ChatColor.GRAY+otherP.getName()+ChatColor.GREEN+" activé.");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
players.put(p, new ArrayList<Player>());
|
||||
sender.sendMessage(ChatColor.GREEN+"Affichage de la sélection activé. Si vous ne voyez pas les particules, activez les dans vos options Minecraft.");
|
||||
if (otherP != null) {
|
||||
players.get(p).add(otherP);
|
||||
sender.sendMessage(ChatColor.GREEN+"Affichage de la sélection de "+ChatColor.GRAY+otherP.getName()+ChatColor.GREEN+" activé.");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -88,7 +122,7 @@ public class CommandWandSelection extends BukkitRunnable implements CommandExecu
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (players.contains(event.getPlayer()))
|
||||
if (players.containsKey(event.getPlayer()))
|
||||
players.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@ -96,8 +130,8 @@ public class CommandWandSelection extends BukkitRunnable implements CommandExecu
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
if (!players.contains(event.getPlayer()))
|
||||
players.add(event.getPlayer());
|
||||
if (!players.containsKey(event.getPlayer()))
|
||||
players.put(event.getPlayer(), new ArrayList<Player>());
|
||||
}
|
||||
|
||||
|
||||
@ -106,29 +140,35 @@ public class CommandWandSelection extends BukkitRunnable implements CommandExecu
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
WorldEditPlugin wePlugin = (WorldEditPlugin) plugin.getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
if (wePlugin == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
for (Player p : players)
|
||||
for (Entry<Player, List<Player>> pl : players.entrySet())
|
||||
{
|
||||
Player p = pl.getKey();
|
||||
// on vérifie que le joueur soit en ligne
|
||||
if (p == null || !p.isOnline())
|
||||
continue;
|
||||
|
||||
Selection sel = wePlugin.getSelection(p);
|
||||
// on garde que les cuboïdes (pas les autres formes)
|
||||
if (!(sel instanceof CuboidSelection))
|
||||
continue;
|
||||
CuboidSelection cubo = (CuboidSelection) sel;
|
||||
CuboidSelection cubo = getPlayerCuboSelection(p);
|
||||
|
||||
// le joueur doit être dans le même monde que sa propre sélection
|
||||
if (cubo.getWorld() != p.getWorld())
|
||||
if (cubo != null && cubo.getWorld() == p.getWorld())
|
||||
drawCuboid(cubo, p, true);
|
||||
|
||||
if (pl.getValue() == null)
|
||||
continue;
|
||||
|
||||
drawCuboid(cubo, p);
|
||||
for (Player po : pl.getValue()){
|
||||
if (po == null || !po.isOnline()) continue;
|
||||
|
||||
cubo = getPlayerCuboSelection(po);
|
||||
|
||||
if (cubo != null && cubo.getWorld() == p.getWorld())
|
||||
drawCuboid(cubo, p, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e) { e.printStackTrace(); }
|
||||
@ -140,7 +180,21 @@ public class CommandWandSelection extends BukkitRunnable implements CommandExecu
|
||||
|
||||
|
||||
|
||||
private void drawCuboid(CuboidSelection cubo, Player p)
|
||||
private CuboidSelection getPlayerCuboSelection(Player p) {
|
||||
WorldEditPlugin wePlugin = (WorldEditPlugin) plugin.getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
if (wePlugin == null) return null;
|
||||
Selection sel = wePlugin.getSelection(p);
|
||||
if (sel == null) return null;
|
||||
// on garde que les cuboïdes (pas les autres formes)
|
||||
if (!(sel instanceof CuboidSelection))
|
||||
return null;
|
||||
return (CuboidSelection) sel;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void drawCuboid(CuboidSelection cubo, Player p, boolean self)
|
||||
{
|
||||
List<Player> pls = new ArrayList<Player>(1);
|
||||
pls.add(p);
|
||||
@ -166,9 +220,13 @@ public class CommandWandSelection extends BukkitRunnable implements CommandExecu
|
||||
if (!(i == x1 || i == x2 || j == y1 || j == y2 || k == z1 || k == z2))
|
||||
continue;
|
||||
Location l = new Location(p1.getWorld(), i, j, k);
|
||||
if (l.distanceSquared(p.getLocation()) < distance*distance)
|
||||
ParticleEffect.HAPPY_VILLAGER
|
||||
.display(offset, offset, offset, 0F, 1, l, pls);
|
||||
if (l.distanceSquared(p.getLocation()) < distance*distance){
|
||||
if (self)
|
||||
ParticleEffect.HAPPY_VILLAGER.display(offset, offset, offset, 0F, 1, l, pls);
|
||||
else
|
||||
ParticleEffect.FLAME.display(offset, offset, offset, 0F, 5, l, pls);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user