-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from insou22/master
This is at least a start. Pleb.
- Loading branch information
Showing
17 changed files
with
463 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,47 @@ | ||
package net.poweredbyhate.trollplus; | ||
|
||
import net.poweredbyhate.trollplus.Trolls.CommandBolt; | ||
import net.poweredbyhate.trollplus.Trolls.CommandBurn; | ||
import net.poweredbyhate.trollplus.Trolls.CommandFakeop; | ||
import net.poweredbyhate.trollplus.Trolls.CommandFreeze; | ||
import net.poweredbyhate.trollplus.Trolls.CommandJarcode; | ||
import net.poweredbyhate.trollplus.listeners.PlayerListener; | ||
import net.poweredbyhate.trollplus.managers.CommandManager; | ||
import net.poweredbyhate.trollplus.managers.TrollPlayerManager; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.player.PlayerJoinEvent; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
/** | ||
* Created by Lax on 4/18/2016. | ||
*/ | ||
public class TrollPlus extends JavaPlugin implements Listener{ | ||
public class TrollPlus extends JavaPlugin { | ||
|
||
private final Listener[] listeners = { | ||
new PlayerListener(this) | ||
}; | ||
|
||
private TrollPlayerManager playerManager; | ||
private CommandManager commandManager; | ||
|
||
@Override // You better annotate every bloody override or I will end you. | ||
public void onEnable() { | ||
Bukkit.getPluginManager().registerEvents(this, this); | ||
enableCommands(); //List of commands to make: http://q.awsmpwrd.com/iVZx.png | ||
loadManagers(); | ||
loadListeners(); | ||
//List of command to make: http://q.awsmpwrd.com/iVZx.png | ||
} | ||
|
||
public void enableCommands() { | ||
getCommand("burn").setExecutor(new CommandBurn(this)); | ||
getCommand("freeze").setExecutor(new CommandFreeze(this)); | ||
getCommand("bolt").setExecutor(new CommandBolt(this)); | ||
//getCommand("special").setExecutor(new CommandSpecial(this)); I have yet to check what a fucking AK-47 is. | ||
getCommand("fakeop").setExecutor(new CommandFakeop(this)); //not done | ||
getCommand("jarcode").setExecutor(new CommandJarcode(this)); | ||
private void loadManagers() { | ||
playerManager = new TrollPlayerManager(this); | ||
commandManager = new CommandManager(this); | ||
} | ||
|
||
String[] ad = { | ||
"&d____----====[ &cSponsored by GNU/Emacs&d ]====----____", | ||
"&aGet emacs for your linux distro now!", | ||
"&bhttps://www.gnu.org/software/emacs/", | ||
|
||
"&aThis troll plugin is sponsored by Emacs!", | ||
"&aEmacs is the one true editor that respects your software freedoms", | ||
" " | ||
}; | ||
private void loadListeners() { | ||
for (Listener listener : listeners) { | ||
Bukkit.getPluginManager().registerEvents(listener, this); | ||
} | ||
} | ||
|
||
public TrollPlayerManager getPlayerManager() { | ||
return playerManager; | ||
} | ||
|
||
@EventHandler | ||
public void onJoin(PlayerJoinEvent ev) { | ||
for (String s : ad) { | ||
ev.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', s)); | ||
} | ||
public CommandManager getCommandManager() { | ||
return commandManager; | ||
} | ||
} |
37 changes: 0 additions & 37 deletions
37
src/main/java/net/poweredbyhate/trollplus/Trolls/CommandBolt.java
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
src/main/java/net/poweredbyhate/trollplus/Trolls/CommandBurn.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
src/main/java/net/poweredbyhate/trollplus/Trolls/CommandFakeop.java
This file was deleted.
Oops, something went wrong.
50 changes: 0 additions & 50 deletions
50
src/main/java/net/poweredbyhate/trollplus/Trolls/CommandFreeze.java
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
src/main/java/net/poweredbyhate/trollplus/Trolls/CommandJarcode.java
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
src/main/java/net/poweredbyhate/trollplus/command/CommandConsumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package net.poweredbyhate.trollplus.command; | ||
|
||
import net.poweredbyhate.trollplus.TrollPlus; | ||
import net.poweredbyhate.trollplus.player.TrollPlayer; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
public abstract class CommandConsumer implements CommandExecutor { | ||
|
||
protected final TrollPlus plugin; | ||
|
||
protected CommandConsumer(TrollPlus plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||
if (!(sender instanceof Player)) { | ||
// Commands can only be executed by Players because fuck the console | ||
sender.sendMessage(ChatColor.RED + "Are ye serious mate? Too stingy to log on to the bloody server are ya?"); | ||
sender.sendMessage(ChatColor.RED + "You can take your bloody console and piss right off mate."); | ||
return false; | ||
} | ||
TrollPlayer player = plugin.getPlayerManager().getPlayer((Player) sender); | ||
onCommand(player, label, args); | ||
return false; | ||
} | ||
|
||
// Only use label to resend the command to the player, no checks are needed | ||
protected abstract void onCommand(TrollPlayer player, String label, String[] args); | ||
|
||
public abstract String getCommand(); | ||
|
||
protected void noPermz(TrollPlayer player) { | ||
player.sendMessage("&cNo Permz"); | ||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/net/poweredbyhate/trollplus/command/trolls/BoltTrollCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package net.poweredbyhate.trollplus.command.trolls; | ||
|
||
import net.poweredbyhate.trollplus.TrollPlus; | ||
import net.poweredbyhate.trollplus.command.CommandConsumer; | ||
import net.poweredbyhate.trollplus.player.TrollPlayer; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.entity.Player; | ||
|
||
/** | ||
* Created by Lax on 4/18/2016. | ||
*/ | ||
public class BoltTrollCommand extends CommandConsumer { | ||
|
||
public BoltTrollCommand(TrollPlus plugin) { | ||
super(plugin); | ||
} | ||
|
||
@Override | ||
protected void onCommand(TrollPlayer player, String label, String[] args) { | ||
if (!player.hasPermissionOrIsOp("trollplus.bolt")) { | ||
noPermz(player); | ||
return; | ||
} | ||
if (args.length == 0) { | ||
player.getPlayer().getLocation().getWorld().strikeLightningEffect(player.getPlayer().getLocation()); | ||
return; | ||
} | ||
if (!player.hasPermissionOrIsOp("trollplus.bolt.others")) { | ||
noPermz(player); | ||
return; | ||
} | ||
Player target = Bukkit.getPlayer(args[0]); | ||
if (target == null) { | ||
player.sendMessage("&cUsage: /" + label + " [player]"); | ||
return; | ||
} | ||
target.getLocation().getWorld().strikeLightningEffect(target.getLocation()); | ||
} | ||
|
||
@Override | ||
public String getCommand() { | ||
return "bolt"; | ||
} | ||
} |
Oops, something went wrong.