Permalink
Browse files

latest (no recent updates)

  • Loading branch information...
1 parent 3c7bf13 commit 980225174476d0e7ac9a2a61703b458ba3a6243d @Zren committed Jul 2, 2011
Showing with 1,496 additions and 37 deletions.
  1. +9 −0 Cinema/.classpath
  2. +17 −0 Cinema/.project
  3. +12 −0 Cinema/.settings/org.eclipse.jdt.core.prefs
  4. BIN Cinema/bin/ca/xshade/bukkit/cinema/Action.class
  5. BIN Cinema/bin/ca/xshade/bukkit/cinema/ActionTask.class
  6. BIN Cinema/bin/ca/xshade/bukkit/cinema/Cinema$1.class
  7. BIN Cinema/bin/ca/xshade/bukkit/cinema/Cinema.class
  8. BIN Cinema/bin/ca/xshade/bukkit/cinema/CinemaPlayerListener.class
  9. BIN Cinema/bin/ca/xshade/bukkit/cinema/GiveAction.class
  10. BIN Cinema/bin/ca/xshade/bukkit/cinema/MoveAction.class
  11. BIN Cinema/bin/ca/xshade/bukkit/cinema/Movie.class
  12. BIN Cinema/bin/ca/xshade/bukkit/cinema/MovieRecorder$RecordingTicker.class
  13. BIN Cinema/bin/ca/xshade/bukkit/cinema/MovieRecorder.class
  14. BIN Cinema/bin/ca/xshade/bukkit/cinema/SayAction.class
  15. +11 −0 Cinema/bin/plugin.yml
  16. BIN Cinema/bin/redecouverte/npcspawner/BasicHumanNpc.class
  17. BIN Cinema/bin/redecouverte/npcspawner/BasicHumanNpcList.class
  18. BIN Cinema/bin/redecouverte/npcspawner/BasicNpc.class
  19. BIN Cinema/bin/redecouverte/npcspawner/CHumanNpc.class
  20. BIN Cinema/bin/redecouverte/npcspawner/NpcEntityTargetEvent$NpcTargetReason.class
  21. BIN Cinema/bin/redecouverte/npcspawner/NpcEntityTargetEvent.class
  22. BIN Cinema/bin/redecouverte/npcspawner/NpcNetHandler.class
  23. BIN Cinema/bin/redecouverte/npcspawner/NpcNetworkManager.class
  24. BIN Cinema/bin/redecouverte/npcspawner/NpcSocket.class
  25. BIN Cinema/bin/redecouverte/npcspawner/NpcSpawner.class
  26. +16 −0 Cinema/mkjar.jardesc
  27. +23 −0 Cinema/src/ca/xshade/bukkit/cinema/Action.java
  28. +19 −0 Cinema/src/ca/xshade/bukkit/cinema/ActionTask.java
  29. +214 −0 Cinema/src/ca/xshade/bukkit/cinema/Cinema.java
  30. +50 −0 Cinema/src/ca/xshade/bukkit/cinema/CinemaPlayerListener.java
  31. +22 −0 Cinema/src/ca/xshade/bukkit/cinema/GiveAction.java
  32. +22 −0 Cinema/src/ca/xshade/bukkit/cinema/MoveAction.java
  33. +111 −0 Cinema/src/ca/xshade/bukkit/cinema/Movie.java
  34. +89 −0 Cinema/src/ca/xshade/bukkit/cinema/MovieRecorder.java
  35. +28 −0 Cinema/src/ca/xshade/bukkit/cinema/SayAction.java
  36. +11 −0 Cinema/src/plugin.yml
  37. +51 −0 Cinema/src/redecouverte/npcspawner/BasicHumanNpc.java
  38. +31 −0 Cinema/src/redecouverte/npcspawner/BasicHumanNpcList.java
  39. +31 −0 Cinema/src/redecouverte/npcspawner/BasicNpc.java
  40. +74 −0 Cinema/src/redecouverte/npcspawner/CHumanNpc.java
  41. +25 −0 Cinema/src/redecouverte/npcspawner/NpcEntityTargetEvent.java
  42. +113 −0 Cinema/src/redecouverte/npcspawner/NpcNetHandler.java
  43. +56 −0 Cinema/src/redecouverte/npcspawner/NpcNetworkManager.java
  44. +24 −0 Cinema/src/redecouverte/npcspawner/NpcSocket.java
  45. +126 −0 Cinema/src/redecouverte/npcspawner/NpcSpawner.java
  46. +6 −0 Invite/ChangeLog.txt
  47. +1 −0 Invite/ToDo.txt
  48. BIN Invite/bin/ca/xshade/bukkit/questioner/BukkitQuestionTask.class
  49. BIN Invite/bin/ca/xshade/bukkit/questioner/Questioner$6.class
  50. BIN Invite/bin/ca/xshade/bukkit/questioner/Questioner.class
  51. BIN Invite/bin/ca/xshade/bukkit/questioner/QuestionerPlayerListener.class
  52. BIN Invite/bin/ca/xshade/questionmanager/AbstractQuestion.class
  53. BIN Invite/bin/ca/xshade/questionmanager/LinkedQuestion.class
  54. BIN Invite/bin/ca/xshade/questionmanager/Question.class
  55. +4 −3 Invite/bin/plugin.yml
  56. +0 −2 Invite/mkjar.jardesc
  57. +19 −0 Invite/src/ca/xshade/bukkit/questioner/BukkitQuestionTask.java
  58. +59 −15 Invite/src/ca/xshade/bukkit/questioner/Questioner.java
  59. +1 −2 Invite/src/ca/xshade/bukkit/questioner/QuestionerPlayerListener.java
  60. +9 −0 Invite/src/ca/xshade/questionmanager/AbstractQuestion.java
  61. +1 −6 Invite/src/ca/xshade/questionmanager/LinkedQuestion.java
  62. +1 −6 Invite/src/ca/xshade/questionmanager/Question.java
  63. +4 −3 Invite/src/plugin.yml
  64. +7 −0 WorldStacker/.classpath
  65. +17 −0 WorldStacker/.project
  66. +12 −0 WorldStacker/.settings/org.eclipse.jdt.core.prefs
  67. BIN WorldStacker/bin/ca/xshade/bukkit/worldstacker/WorldStacker$1.class
  68. BIN WorldStacker/bin/ca/xshade/bukkit/worldstacker/WorldStacker$2.class
  69. BIN WorldStacker/bin/ca/xshade/bukkit/worldstacker/WorldStacker.class
  70. +6 −0 WorldStacker/bin/plugin.yml
  71. +16 −0 WorldStacker/mkjar.jardesc
  72. +142 −0 WorldStacker/src/ca/xshade/bukkit/worldstacker/WorldStacker.java
  73. +6 −0 WorldStacker/src/plugin.yml
View
@@ -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.6"/>
+ <classpathentry kind="lib" path="C:/Users/Admin/Desktop/Bukkit/Server/bukkit.jar" sourcepath="C:/Users/Admin/Desktop/git/Bukkit"/>
+ <classpathentry kind="lib" path="C:/Users/Admin/Desktop/Bukkit/Server/craftbukkit.jar"/>
+ <classpathentry kind="lib" path="C:/Users/Admin/Desktop/Bukkit/Server/plugins/Vanish.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Cinema</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>
@@ -0,0 +1,12 @@
+#Thu Mar 17 04:31:19 EDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+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.6
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -0,0 +1,11 @@
+name: Cinema
+main: ca.xshade.bukkit.cinema.Cinema
+version: 0.1
+author: Shade
+website: http://towny.xshade.ca
+description: ''
+commands:
+ detach:
+ description: ''
+ cinema:
+ description: ''
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
+<jardesc>
+ <jar path="C:/Users/Admin/Desktop/Bukkit/Server/plugins/Cinema.jar"/>
+ <options buildIfNeeded="true" compress="false" descriptionLocation="/Cinema/mkjar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="true" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
+ <storedRefactorings deprecationInfo="true" structuralOnly="false"/>
+ <selectedProjects/>
+ <manifest generateManifest="true" manifestLocation="/Towny/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
+ <sealing sealJar="false">
+ <packagesToSeal/>
+ <packagesToUnSeal/>
+ </sealing>
+ </manifest>
+ <selectedElements exportClassFiles="false" exportJavaFiles="false" exportOutputFolder="true">
+ <javaElement handleIdentifier="=Cinema/src"/>
+ </selectedElements>
+</jardesc>
@@ -0,0 +1,23 @@
+package ca.xshade.bukkit.cinema;
+
+import org.bukkit.entity.Player;
+
+public abstract class Action implements Comparable {
+ protected long t;
+ abstract boolean doAction(Player player);
+
+ public long getT() {
+ return t;
+ }
+
+ public String toString() {
+ return t+";a";
+ }
+
+ public int compareTo(Object o) {
+ if (o instanceof Action)
+ return (int)(this.t - ((Action)o).t);
+ else
+ return -1;
+ }
+}
@@ -0,0 +1,19 @@
+package ca.xshade.bukkit.cinema;
+
+import java.util.TimerTask;
+
+import org.bukkit.entity.Player;
+
+public class ActionTask extends TimerTask {
+ private Action action;
+ private Player player;
+
+ public ActionTask(Action action, Player player) {
+ this.player = player;
+ this.action = action;
+ }
+
+ public void run() {
+ action.doAction(player);
+ }
+}
@@ -0,0 +1,214 @@
+package ca.xshade.bukkit.cinema;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Timer;
+
+import net.minecraft.server.Packet20NamedEntitySpawn;
+import net.minecraft.server.Packet29DestroyEntity;
+
+import org.bukkit.Location;
+import org.bukkit.Server;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.Event.Priority;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import redecouverte.npcspawner.BasicHumanNpc;
+import redecouverte.npcspawner.BasicHumanNpcList;
+import redecouverte.npcspawner.NpcSpawner;
+
+import com.echo28.bukkit.vanish.Vanish;
+
+public class Cinema extends JavaPlugin {
+ public BasicHumanNpcList HumanNPCList;
+ protected static Server server = null;
+
+ protected CinemaPlayerListener playerListener = new CinemaPlayerListener();
+
+ protected static HashMap<String, Movie> movies;
+ protected static HashMap<String, MovieRecorder> actors;
+ protected static ArrayList<MovieRecorder> inDevFilms;
+
+
+ @Override
+ public void onDisable() {
+ movies = null;
+ actors = null;
+ inDevFilms = null;
+ }
+
+ @Override
+ public void onEnable() {
+ server = getServer();
+ this.HumanNPCList = new BasicHumanNpcList();
+
+
+ movies = new HashMap<String, Movie>();
+ actors = new HashMap<String, MovieRecorder>();
+ inDevFilms = new ArrayList<MovieRecorder>();
+
+ load();
+
+ getServer().getPluginManager().registerEvent(Event.Type.PLAYER_ANIMATION, playerListener, Priority.Normal, this);
+ getServer().getPluginManager().registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Normal, this);
+ }
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
+ if (sender instanceof Player) {
+ Player player = (Player)sender;
+ String cmd = command.getName().toLowerCase();
+ Location l = player.getLocation();
+
+ if (cmd.equals("detach")) {
+ Plugin test = getServer().getPluginManager().getPlugin("Vanish");
+ if (test == null)
+ return false;
+ if (!test.isEnabled())
+ return false;
+ Vanish vanish = (Vanish)test;
+
+ BasicHumanNpc hnpc = NpcSpawner.SpawnBasicHumanNpc(player.getName(), player.getName(), player.getWorld(), l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch());
+ this.HumanNPCList.put(player.getName(), hnpc);
+
+ vanish.vanish(player);
+ } else if (cmd.equals("cinema")) {
+ if (args.length > 0) {
+ if (args[0].equalsIgnoreCase("play") && args.length == 2) {
+ Movie movie = movies.get(args[1]);
+ if (movie != null) {
+ watchMovie(player, movie);
+ player.sendMessage("Arena location set.");
+ return true;
+ } else {
+ player.sendMessage("No movie with that name.");
+ }
+ } else if (args[0].equalsIgnoreCase("record") && args.length == 2) {
+ if (!actors.containsKey(player.getName())) {
+ Movie movie = new Movie(args[1]);
+ MovieRecorder movieRecorder = new MovieRecorder(movie, getDataFolder().getPath()+"/"+args[1]+".txt", player.getName());
+ actors.put(player.getName(), movieRecorder);
+ inDevFilms.add(movieRecorder);
+ player.sendMessage("You started directing a new movie.");
+ } else {
+ player.sendMessage("Your already filming a movie.");
+ }
+ return true;
+ } else if (args[0].equalsIgnoreCase("list")) {
+ player.sendMessage("--- Movies ---");
+ for (String movie : movies.keySet())
+ player.sendMessage(movie);
+ return true;
+ }
+ }
+
+ // Howto use command
+ player.sendMessage(" §3/cinema §brecord [movie] : Start recording a new movie");
+ player.sendMessage(" §3Swing");
+ player.sendMessage(" §bObsidian : Action! / Cut (auto save on cut)");
+ player.sendMessage(" §bBookcase : Insert empty text annotation");
+ player.sendMessage(" §bChest : Insert empty item gift");
+ player.sendMessage(" §3/cinema §bplay [movie] : Playback a movie");
+ player.sendMessage(" §3/cinema §blist : Display a list of movies");
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void vanishVanish(Vanish vanish, Player player) {
+ if (vanish.invisible.contains(player))
+ {
+ vanish.reappear(player);
+ return;
+ }
+ vanish.invisible.add(player);
+ Player[] playerList = getServer().getOnlinePlayers();
+ for (Player p : playerList)
+ {
+ if (vanish.getDistance(player, p) <= vanish.RANGE && !p.equals(player))
+ {
+ vanishInvisible(player, p);
+ }
+ }
+ }
+
+ public void vanishReappear(Vanish vanish, Player player) {
+ if (vanish.invisible.contains(player))
+ {
+ vanish.invisible.remove(player);
+ // make someone really disappear if there's any doubt, should remove
+ // cloning
+ vanish.updateInvisibleForAll();
+ Player[] playerList = getServer().getOnlinePlayers();
+ for (Player p : playerList)
+ {
+ if (vanish.getDistance(player, p) < vanish.RANGE && !p.equals(player))
+ {
+ vanishUninvisible(player, p);
+ }
+ }
+ }
+ }
+
+ private void vanishInvisible(Player p1, Player p2) {
+ CraftPlayer hide = (CraftPlayer) p1;
+ CraftPlayer hideFrom = (CraftPlayer) p2;
+ hideFrom.getHandle().a.b(new Packet29DestroyEntity(hide.getEntityId()));
+ }
+
+ private void vanishUninvisible(Player p1, Player p2) {
+ CraftPlayer unHide = (CraftPlayer) p1;
+ CraftPlayer unHideFrom = (CraftPlayer) p2;
+ unHideFrom.getHandle().a.b(new Packet20NamedEntitySpawn(unHide.getHandle()));
+ }
+
+ public void load() {
+ File dir = getDataFolder();
+ try {
+ if (!(dir.exists() && dir.isDirectory()))
+ dir.mkdir();
+ } catch(Exception e) {
+ System.out.println("[Cinema] Error creating default file and folder.");
+ }
+
+ FilenameFilter filter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".txt");
+ }
+ };
+ String[] children = dir.list(filter);
+ if (children != null) {
+ for (String filmFilename : children) {
+ String filmName = filmFilename.substring(0, filmFilename.length()-4);
+ if (filmName.split(" ").length > 1)
+ continue;
+
+ Movie movie = new Movie(filmName);
+ movie.load(getDataFolder().getPath() + "/" + filmFilename);
+ movies.put(movie.getName(), movie);
+ }
+ }
+ }
+
+ public static void deleteInDevFilm(MovieRecorder film) {
+ actors.remove(film.getActor());
+ inDevFilms.remove(film);
+ }
+
+ public static void watchMovie(Player player, Movie movie) {
+ Timer timer = new Timer();
+
+ for (Action action : movie.getActions())
+ timer.schedule(new ActionTask(action, player), action.getT());
+ }
+}
@@ -0,0 +1,50 @@
+package ca.xshade.bukkit.cinema;
+
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerAnimationEvent;
+import org.bukkit.event.player.PlayerAnimationType;
+import org.bukkit.event.player.PlayerListener;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.inventory.ItemStack;
+
+class CinemaPlayerListener extends PlayerListener {
+ @Override
+ public void onPlayerAnimation(PlayerAnimationEvent event) {
+ Player player = event.getPlayer();
+ if (event.getAnimationType() == PlayerAnimationType.ARM_SWING) {
+ MovieRecorder film = Cinema.actors.get(player.getName());
+ if (film != null) {
+ if (film.hasActor(player.getName())) {
+ ItemStack hand = player.getItemInHand();
+ if (hand.getType() == Material.OBSIDIAN) {
+ if (!film.isRecording()) {
+ film.start();
+ player.sendMessage("Started recording");
+ } else {
+ film.finish();
+ Movie movie = film.getMovie();
+ Cinema.movies.put(movie.getName(), movie);
+ Cinema.deleteInDevFilm(film);
+ player.sendMessage("Finished recording");
+ }
+ } else if (hand.getType() == Material.BOOKSHELF) {
+ film.addAction(new SayAction(film.getRecordingTime(), new String[]{}));
+ } else if (hand.getType() == Material.CHEST) {
+ film.addAction(new GiveAction(film.getRecordingTime(), new ItemStack(1)));
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onPlayerMove(PlayerMoveEvent event) {
+ Player player = event.getPlayer();
+ MovieRecorder film = Cinema.actors.get(player.getName());
+ if (film != null && film.isRecording()) {
+ Movie movie = film.getMovie();
+ movie.addAction(new MoveAction(film.getRecordingTime(), player.getLocation()));
+ }
+ }
+}
Oops, something went wrong. Retry.

0 comments on commit 9802251

Please sign in to comment.