This file contains hidden or 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
| import lombok.Delegate; | |
| import org.apache.commons.lang.Validate; | |
| import java.util.Comparator; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| import java.util.Set; | |
| import java.util.TreeMap; | |
| /** |
This file contains hidden or 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
| public BlockFace getFacing(Location loc) | |
| { | |
| float pitch = loc.getPitch(); | |
| for(;pitch < 0; pitch += 360F); | |
| pitch %= 360F; | |
| int pitchdir = Math.round(pitch/90F) % 4; | |
| switch(pitchdir) | |
| { | |
| case 1: |
This file contains hidden or 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
| package net.darkseraphim.serialization; | |
| import org.bukkit.Bukkit; | |
| import org.bukkit.inventory.ItemStack; | |
| import org.bukkit.inventory.meta.ItemMeta; | |
| import java.io.*; | |
| import java.lang.reflect.Method; | |
| import java.util.Map; |
This file contains hidden or 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
| { | |
| # Here you can add multiple image uploaders | |
| # They go in the format as shown below | |
| # Btw I added a 'comment' | |
| "apis": | |
| [ | |
| # As JSON requires us to create a new 'object' each API | |
| { | |
| # A name is just a name for the GUI, all it should do | |
| # is tell you where it will upload. |
This file contains hidden or 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
| package net.darkseraphim.utils; | |
| import java.lang.reflect.Constructor; | |
| import java.lang.reflect.Field; | |
| import java.lang.reflect.Method; | |
| import org.bukkit.Bukkit; | |
| import org.bukkit.entity.Player; | |
| import org.bukkit.inventory.Inventory; |
This file contains hidden or 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
| package net.darkseraphim.happyhour; | |
| import net.milkbowl.vault.economy.EconomyResponse; | |
| import java.util.List; | |
| /** | |
| * @author DarkSeraphim | |
| */ | |
| public class Economy implements net.milkbowl.vault.economy.Economy |
This file contains hidden or 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
| package net.darkseraphim.actionbar; | |
| import java.lang.reflect.Field; | |
| import java.lang.reflect.Modifier; | |
| import net.minecraft.server.v1_7_R4.EnumProtocol; | |
| import net.minecraft.server.v1_7_R4.NetworkManager; | |
| import net.minecraft.server.v1_7_R4.Packet; | |
| import net.minecraft.server.v1_7_R4.PacketPlayOutChat; | |
| import net.minecraft.util.com.google.common.collect.BiMap; | |
| import net.minecraft.util.io.netty.channel.Channel; |
This file contains hidden or 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
| List<Trade> trades = new ArrayList<Trade>() | |
| { | |
| public Iterator<Trade> iterator() | |
| { | |
| final Iterator<Trade> s = super.iterator(); | |
| return new Iterator<Trade>() | |
| { | |
| private final List<?> nmsList = list; | |
| private final Iterator<Trade> delegate = s; |
This file contains hidden or 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
| var express = require('express'); | |
| // ... | |
| var app = express(); | |
| // ... | |
| var server = app.listen(80, function() | |
| { | |
| console.log("Listening on port ", (server.address().port)); | |
| }); | |
| // Early binding: |
This file contains hidden or 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
| // Check the thread. It might not be thread safe, in which case | |
| // you should be fine with a Collections.synchronizedList() wrap | |
| LinkedHashSet<PacketContainer> queue = new LinkedHashSet<PacketContainer>(); | |
| // Same for this, though ConcurrentHashMap instead of a HashMap | |
| Map<PacketContainer, List<Player>> receivers = new HashMap<PacketContainer, List<Player>>(); | |
| private class ContainerWrapper | |
| { | |
| private final PacketContainer container; | |